mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
593 B
21 lines
593 B
'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.strictEqual(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.strictEqual(err.filename, 'non-existent-file');
|
|
}));
|
|
watcher._handle.onchange(-1, 'ENOENT', 'non-existent-file');
|
|
|