-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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]>
- Loading branch information
Showing
2 changed files
with
21 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters