Skip to content

Commit 74e2328

Browse files
Trottrvagg
authored andcommitted
test: split independent tests into separate files
Move ENOENT related tests out of general fs.watch() test file and into its own file. This may help diagnose #3541. PR-URL: #3548 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Johan Bergström <[email protected]>
1 parent 239ad89 commit 74e2328

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

test/parallel/test-fs-watch-enoent.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const fs = require('fs');
5+
6+
assert.throws(function() {
7+
fs.watch('non-existent-file');
8+
}, function(err) {
9+
assert(err);
10+
assert(/non-existent-file/.test(err));
11+
assert.equal(err.filename, 'non-existent-file');
12+
return true;
13+
});
14+
15+
const watcher = fs.watch(__filename);
16+
watcher.on('error', common.mustCall(function(err) {
17+
assert(err);
18+
assert(/non-existent-file/.test(err));
19+
assert.equal(err.filename, 'non-existent-file');
20+
}));
21+
watcher._handle.onchange(-1, 'ENOENT', 'non-existent-file');

test/sequential/test-fs-watch.js

-17
Original file line numberDiff line numberDiff line change
@@ -126,20 +126,3 @@ assert.throws(function() {
126126
w.stop();
127127
}, TypeError);
128128
oldhandle.stop(); // clean up
129-
130-
assert.throws(function() {
131-
fs.watch('non-existent-file');
132-
}, function(err) {
133-
assert(err);
134-
assert(/non-existent-file/.test(err));
135-
assert.equal(err.filename, 'non-existent-file');
136-
return true;
137-
});
138-
139-
var watcher = fs.watch(__filename);
140-
watcher.on('error', common.mustCall(function(err) {
141-
assert(err);
142-
assert(/non-existent-file/.test(err));
143-
assert.equal(err.filename, 'non-existent-file');
144-
}));
145-
watcher._handle.onchange(-1, 'ENOENT', 'non-existent-file');

0 commit comments

Comments
 (0)