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 https://github.com/nodejs/node/issues/3541. PR-URL: https://github.com/nodejs/node/pull/3548 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <mic.besace@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
This commit is contained in:
parent
d394e9e6bb
commit
26e47efbca
21
test/parallel/test-fs-watch-enoent.js
Normal file
21
test/parallel/test-fs-watch-enoent.js
Normal file
@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const fs = require('fs');
|
||||
|
||||
assert.throws(function() {
|
||||
fs.watch('non-existent-file');
|
||||
}, function(err) {
|
||||
assert(err);
|
||||
assert(/non-existent-file/.test(err));
|
||||
assert.equal(err.filename, 'non-existent-file');
|
||||
return true;
|
||||
});
|
||||
|
||||
const watcher = fs.watch(__filename);
|
||||
watcher.on('error', common.mustCall(function(err) {
|
||||
assert(err);
|
||||
assert(/non-existent-file/.test(err));
|
||||
assert.equal(err.filename, 'non-existent-file');
|
||||
}));
|
||||
watcher._handle.onchange(-1, 'ENOENT', 'non-existent-file');
|
@ -126,20 +126,3 @@ assert.throws(function() {
|
||||
w.stop();
|
||||
}, TypeError);
|
||||
oldhandle.stop(); // clean up
|
||||
|
||||
assert.throws(function() {
|
||||
fs.watch('non-existent-file');
|
||||
}, function(err) {
|
||||
assert(err);
|
||||
assert(/non-existent-file/.test(err));
|
||||
assert.equal(err.filename, 'non-existent-file');
|
||||
return true;
|
||||
});
|
||||
|
||||
var watcher = fs.watch(__filename);
|
||||
watcher.on('error', common.mustCall(function(err) {
|
||||
assert(err);
|
||||
assert(/non-existent-file/.test(err));
|
||||
assert.equal(err.filename, 'non-existent-file');
|
||||
}));
|
||||
watcher._handle.onchange(-1, 'ENOENT', 'non-existent-file');
|
||||
|
Loading…
x
Reference in New Issue
Block a user