| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 239ad89 commit 74e2328
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,21 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + const assert = require('assert'); | ||
| 4 | + const fs = require('fs'); | ||
| 5 | + | ||
| 6 | + assert.throws(function() { | ||
| 7 | + fs.watch('non-existent-file'); | ||
| 8 | + }, function(err) { | ||
| 9 | + assert(err); | ||
| 10 | + assert(/non-existent-file/.test(err)); | ||
| 11 | + assert.equal(err.filename, 'non-existent-file'); | ||
| 12 | + return true; | ||
| 13 | + }); | ||
| 14 | + | ||
| 15 | + const watcher = fs.watch(__filename); | ||
| 16 | + watcher.on('error', common.mustCall(function(err) { | ||
| 17 | + assert(err); | ||
| 18 | + assert(/non-existent-file/.test(err)); | ||
| 19 | + assert.equal(err.filename, 'non-existent-file'); | ||
| 20 | + })); | ||
| 21 | + watcher._handle.onchange(-1, 'ENOENT', 'non-existent-file'); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -126,20 +126,3 @@ assert.throws(function() { | |||
| 126 | 126 | w.stop(); | |
| 127 | 127 | }, TypeError); | |
| 128 | 128 | oldhandle.stop(); // clean up | |
| 129 | - | ||
| 130 | - assert.throws(function() { | ||
| 131 | - fs.watch('non-existent-file'); | ||
| 132 | - }, function(err) { | ||
| 133 | - assert(err); | ||
| 134 | - assert(/non-existent-file/.test(err)); | ||
| 135 | - assert.equal(err.filename, 'non-existent-file'); | ||
| 136 | - return true; | ||
| 137 | - }); | ||
| 138 | - | ||
| 139 | - var watcher = fs.watch(__filename); | ||
| 140 | - watcher.on('error', common.mustCall(function(err) { | ||
| 141 | - assert(err); | ||
| 142 | - assert(/non-existent-file/.test(err)); | ||
| 143 | - assert.equal(err.filename, 'non-existent-file'); | ||
| 144 | - })); | ||
| 145 | - watcher._handle.onchange(-1, 'ENOENT', 'non-existent-file'); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments