From 74e2328b3a1d6fcab508a6890adadeecbac9ec39 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 27 Oct 2015 09:40:41 -0700 Subject: [PATCH] test: split independent tests into separate files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move ENOENT related tests out of general fs.watch() test file and into its own file. This may help diagnose https://github.com/nodejs/node/issues/3541. PR-URL: https://github.com/nodejs/node/pull/3548 Reviewed-By: Colin Ihrig Reviewed-By: Michaël Zasso Reviewed-By: Johan Bergström --- test/parallel/test-fs-watch-enoent.js | 21 +++++++++++++++++++++ test/sequential/test-fs-watch.js | 17 ----------------- 2 files changed, 21 insertions(+), 17 deletions(-) create mode 100644 test/parallel/test-fs-watch-enoent.js diff --git a/test/parallel/test-fs-watch-enoent.js b/test/parallel/test-fs-watch-enoent.js new file mode 100644 index 00000000000000..f9aa58c3d522cc --- /dev/null +++ b/test/parallel/test-fs-watch-enoent.js @@ -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'); diff --git a/test/sequential/test-fs-watch.js b/test/sequential/test-fs-watch.js index 385cf47686f2a8..10f4baf591ae0b 100644 --- a/test/sequential/test-fs-watch.js +++ b/test/sequential/test-fs-watch.js @@ -126,20 +126,3 @@ assert.throws(function() { w.stop(); }, TypeError); oldhandle.stop(); // clean up - -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; -}); - -var 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');