test: refactor test-fs-watchfile
* use `common.mustNotCall()` to confirm callback is not called * reorder modules to conform with test-writing guide * match full error message in `assert.throws()` PR-URL: https://github.com/nodejs/node/pull/13721 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
24ecc331e2
commit
fd9a30f10e
@ -1,21 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
|
||||
const assert = require('assert');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const assert = require('assert');
|
||||
|
||||
// Basic usage tests.
|
||||
assert.throws(function() {
|
||||
fs.watchFile('./some-file');
|
||||
}, /"watchFile\(\)" requires a listener function/);
|
||||
}, /^Error: "watchFile\(\)" requires a listener function$/);
|
||||
|
||||
assert.throws(function() {
|
||||
fs.watchFile('./another-file', {}, 'bad listener');
|
||||
}, /"watchFile\(\)" requires a listener function/);
|
||||
}, /^Error: "watchFile\(\)" requires a listener function$/);
|
||||
|
||||
assert.throws(function() {
|
||||
fs.watchFile(new Object(), common.noop);
|
||||
fs.watchFile(new Object(), common.mustNotCall());
|
||||
}, common.expectsError({code: 'ERR_INVALID_ARG_TYPE', type: TypeError}));
|
||||
|
||||
const enoentFile = path.join(common.tmpDir, 'non-existent-file');
|
||||
|
Loading…
x
Reference in New Issue
Block a user