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.
22 lines
581 B
22 lines
581 B
9 years ago
|
'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');
|