Skip to content

Commit

Permalink
test: split independent tests into separate files
Browse files Browse the repository at this point in the history
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 <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
  • Loading branch information
Trott authored and jasnell committed Oct 30, 2015
1 parent 3f62952 commit c563a34
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
21 changes: 21 additions & 0 deletions test/parallel/test-fs-watch-enoent.js
Original file line number Diff line number Diff line change
@@ -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');
17 changes: 0 additions & 17 deletions test/sequential/test-fs-watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

0 comments on commit c563a34

Please sign in to comment.