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
581 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.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');