Skip to content

Commit 100ccf9

Browse files
Trottaddaleax
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 e36561a commit 100ccf9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎test/parallel/test-fs-watchfile.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
'use strict';
2-
32
constcommon=require('../common');
3+
4+
constassert=require('assert');
45
constfs=require('fs');
56
constpath=require('path');
6-
constassert=require('assert');
77

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

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

1717
assert.throws(function(){
18-
fs.watchFile(newObject(),common.noop);
18+
fs.watchFile(newObject(),common.mustNotCall());
1919
},/Pathmustbeastring/);
2020

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

0 commit comments

Comments
(0)