Skip to content

Commit 0bcbcca

Browse files
TrottMylesBorins
authored andcommitted
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: #13721 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 81edf59 commit 0bcbcca

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test/parallel/test-fs-watchfile.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
'use strict';
2-
32
const common = require('../common');
3+
4+
const assert = require('assert');
45
const fs = require('fs');
56
const path = require('path');
6-
const assert = require('assert');
77

88
// Basic usage tests.
99
assert.throws(function() {
1010
fs.watchFile('./some-file');
11-
}, /"watchFile\(\)" requires a listener function/);
11+
}, /^Error: "watchFile\(\)" requires a listener function$/);
1212

1313
assert.throws(function() {
1414
fs.watchFile('./another-file', {}, 'bad listener');
15-
}, /"watchFile\(\)" requires a listener function/);
15+
}, /^Error: "watchFile\(\)" requires a listener function$/);
1616

1717
assert.throws(function() {
18-
fs.watchFile(new Object(), common.noop);
18+
fs.watchFile(new Object(), common.mustNotCall());
1919
}, /Path must be a string/);
2020

2121
const enoentFile = path.join(common.tmpDir, 'non-existent-file');

0 commit comments

Comments
 (0)