From fa5984bc9586696c816c6b72542743bb5aa3d03c Mon Sep 17 00:00:00 2001 From: Eran Levin Date: Sat, 12 Oct 2019 12:23:07 +0300 Subject: [PATCH 01/15] fs: watch signals for recursive incompatibility this pull request makes fs.watch throw exception, whenever it is used in an incompatible platform. for this change following changes were made to api: 1.a new error type has been introduced. 2.fs.watch has been changed accordingly. Users who use recursive on non-windows and osx platforms, will face a new exception. for this reason, it's a breaking change. Fixes: https://github.com/nodejs/node/issues/29901 --- lib/fs.js | 7 +++++-- lib/internal/errors.js | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index 40453bc15c1efb..4f8fd39b784a9d 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -62,7 +62,8 @@ const { ERR_FS_FILE_TOO_LARGE, ERR_INVALID_ARG_VALUE, ERR_INVALID_ARG_TYPE, - ERR_INVALID_CALLBACK + ERR_INVALID_CALLBACK, + ERR_OPTION_INCOMPATIBLE_WITH_PLATFORM }, uvException } = require('internal/errors'); @@ -129,6 +130,7 @@ let FileReadStream; let FileWriteStream; const isWindows = process.platform === 'win32'; +const isOSX = process.platform === 'darwin'; function showTruncateDeprecation() { @@ -1359,7 +1361,8 @@ function watch(filename, options, listener) { if (options.persistent === undefined) options.persistent = true; if (options.recursive === undefined) options.recursive = false; - + if(options.recursive&&!(isOSX||isWindows)) + throw new ERR_OPTION_INCOMPATIBLE_WITH_PLATFORM('recursive'); if (!watchers) watchers = require('internal/fs/watchers'); const watcher = new watchers.FSWatcher(); diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 5b80092ee312de..9c3d99f75f9fa7 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -1201,6 +1201,8 @@ E('ERR_NO_CRYPTO', 'Node.js is not compiled with OpenSSL crypto support', Error); E('ERR_NO_ICU', '%s is not supported on Node.js compiled without ICU', TypeError); +E('ERR_OPTION_INCOMPATIBLE_WITH_PLATFORM', + (option)=>`Option ${option} is incompatible with the current platform, which is being used to run Node.js`, TypeError); E('ERR_OUT_OF_RANGE', (str, range, input, replaceDefaultBoolean = false) => { assert(range, 'Missing "range" argument'); From b731daca903a5eeee5bab16ff2a06f2ad9a6239b Mon Sep 17 00:00:00 2001 From: Eran Levin Date: Sat, 12 Oct 2019 19:02:34 +0300 Subject: [PATCH 02/15] Some lints to the fs.js file. --- lib/fs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fs.js b/lib/fs.js index 4f8fd39b784a9d..a8436fba24d54c 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -1361,7 +1361,7 @@ function watch(filename, options, listener) { if (options.persistent === undefined) options.persistent = true; if (options.recursive === undefined) options.recursive = false; - if(options.recursive&&!(isOSX||isWindows)) + if (options.recursive && !(isOSX || isWindows)) throw new ERR_OPTION_INCOMPATIBLE_WITH_PLATFORM('recursive'); if (!watchers) watchers = require('internal/fs/watchers'); From 20d6e4cb206e2cae9fe69698869613fc5b752366 Mon Sep 17 00:00:00 2001 From: Eran Levin Date: Sat, 12 Oct 2019 19:03:40 +0300 Subject: [PATCH 03/15] A new error ERR_OPTION_INCOMPATIBLE_WITH_PLATFORM is added to node. --- lib/internal/errors.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 9c3d99f75f9fa7..7233c2c2c1e5ac 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -1202,7 +1202,9 @@ E('ERR_NO_CRYPTO', E('ERR_NO_ICU', '%s is not supported on Node.js compiled without ICU', TypeError); E('ERR_OPTION_INCOMPATIBLE_WITH_PLATFORM', - (option)=>`Option ${option} is incompatible with the current platform, which is being used to run Node.js`, TypeError); + (option) => 'The option ' + option + + 'is incompatible with the current platform' + + ',which is being used to run Node.js', TypeError); E('ERR_OUT_OF_RANGE', (str, range, input, replaceDefaultBoolean = false) => { assert(range, 'Missing "range" argument'); From 98e7561f5dff246f8da2463a2c7637d2b791a582 Mon Sep 17 00:00:00 2001 From: Eran Levin Date: Sat, 12 Oct 2019 19:04:55 +0300 Subject: [PATCH 04/15] update the relevant test: if on win or osx no exception should be thrown. Otherwise, the new error should be thrown. --- test/parallel/test-fs-watch-recursive.js | 53 +++++++++++++----------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/test/parallel/test-fs-watch-recursive.js b/test/parallel/test-fs-watch-recursive.js index 4985ece0e0ec15..1d4d82d25acb3c 100644 --- a/test/parallel/test-fs-watch-recursive.js +++ b/test/parallel/test-fs-watch-recursive.js @@ -2,8 +2,6 @@ const common = require('../common'); -if (!(common.isOSX || common.isWindows)) - common.skip('recursive option is darwin/windows specific'); const assert = require('assert'); const path = require('path'); @@ -20,32 +18,39 @@ const testsubdir = fs.mkdtempSync(testDir + path.sep); const relativePathOne = path.join(path.basename(testsubdir), filenameOne); const filepathOne = path.join(testsubdir, filenameOne); -const watcher = fs.watch(testDir, { recursive: true }); +try { + const watcher = fs.watch(testDir, { recursive: true }); -let watcherClosed = false; -watcher.on('change', function(event, filename) { - assert.ok(event === 'change' || event === 'rename'); + let watcherClosed = false; + watcher.on('change', function(event, filename) { + assert.ok(event === 'change' || event === 'rename'); - // Ignore stale events generated by mkdir and other tests - if (filename !== relativePathOne) - return; + // Ignore stale events generated by mkdir and other tests + if (filename !== relativePathOne) + return; + if (common.isOSX) { + clearInterval(interval); + } + watcher.close(); + watcherClosed = true; + }); + + let interval; if (common.isOSX) { - clearInterval(interval); + interval = setInterval(function() { + fs.writeFileSync(filepathOne, 'world'); + }, 10); + } else { + fs.writeFileSync(filepathOne, 'world'); } - watcher.close(); - watcherClosed = true; -}); -let interval; -if (common.isOSX) { - interval = setInterval(function() { - fs.writeFileSync(filepathOne, 'world'); - }, 10); -} else { - fs.writeFileSync(filepathOne, 'world'); + process.on('exit', function() { + assert(watcherClosed, 'watcher Object was not closed'); + }); +} catch (err) { + if ((common.isOSX || common.isWindows)) + throw err; + else if (err.code !== 'ERR_OPTION_INCOMPATIBLE_WITH_PLATFORM') + throw err; } - -process.on('exit', function() { - assert(watcherClosed, 'watcher Object was not closed'); -}); From d985a42fe365bf7e03d10858612afdbe59ae030d Mon Sep 17 00:00:00 2001 From: Eran Levin Date: Sat, 12 Oct 2019 19:06:52 +0300 Subject: [PATCH 05/15] Documenting the new changes: 1. The error that was introduced. 2. The new behaviour of fs.watch (throws exception) --- doc/api/errors.md | 5 +++++ doc/api/fs.md | 2 ++ 2 files changed, 7 insertions(+) diff --git a/doc/api/errors.md b/doc/api/errors.md index d16149b00bec50..1c796075d02a74 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -2412,6 +2412,11 @@ The `--entry-type=...` flag is not compatible with the Node.js REPL. Used when an [ES Module][] loader hook specifies `format: 'dynamic'` but does not provide a `dynamicInstantiate` hook. + +#### ERR_OPTION_INCOMPATIBLE_WITH_PLATFORM + +Used when a function is called, +with an incompatible option to the current platform which is running Node.js. #### `ERR_STREAM_HAS_STRINGDECODER` diff --git a/doc/api/fs.md b/doc/api/fs.md index 01d99c80366f45..3e481ac9c883f3 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -3766,6 +3766,8 @@ The `fs.watch` API is not 100% consistent across platforms, and is unavailable in some situations. The recursive option is only supported on macOS and Windows. +An `ERR_OPTION_INCOMPATIBLE_WITH_PLATFORM` exception will be thrown, + if the option is used in an incompatible platform. #### Availability From bdb2a7d13fca01e7a47c7e46c3eefa2903b6475b Mon Sep 17 00:00:00 2001 From: exx8 Date: Sat, 12 Oct 2019 19:53:26 +0300 Subject: [PATCH 06/15] A style change Co-Authored-By: mscdex --- test/parallel/test-fs-watch-recursive.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-fs-watch-recursive.js b/test/parallel/test-fs-watch-recursive.js index 1d4d82d25acb3c..ad41e1007a373f 100644 --- a/test/parallel/test-fs-watch-recursive.js +++ b/test/parallel/test-fs-watch-recursive.js @@ -49,7 +49,7 @@ try { assert(watcherClosed, 'watcher Object was not closed'); }); } catch (err) { - if ((common.isOSX || common.isWindows)) + if (common.isOSX || common.isWindows) throw err; else if (err.code !== 'ERR_OPTION_INCOMPATIBLE_WITH_PLATFORM') throw err; From c6373f35c3df413a88c1031cf3da8183bc28fafe Mon Sep 17 00:00:00 2001 From: Eran Levin Date: Sun, 13 Oct 2019 09:31:40 +0300 Subject: [PATCH 07/15] fix according to review --- doc/api/errors.md | 9 +++++---- lib/fs.js | 4 ++-- lib/internal/errors.js | 8 ++++---- test/parallel/test-fs-watch-recursive.js | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/doc/api/errors.md b/doc/api/errors.md index 1c796075d02a74..b4df10e2b0ed8e 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -2412,11 +2412,12 @@ The `--entry-type=...` flag is not compatible with the Node.js REPL. Used when an [ES Module][] loader hook specifies `format: 'dynamic'` but does not provide a `dynamicInstantiate` hook. - -#### ERR_OPTION_INCOMPATIBLE_WITH_PLATFORM + +#### ERR_FEATURE_UNAVAILABLE_ON_PLATFORM + +Used when a feature that is not available +to the current platform which is running Node.js is used. -Used when a function is called, -with an incompatible option to the current platform which is running Node.js. #### `ERR_STREAM_HAS_STRINGDECODER` diff --git a/lib/fs.js b/lib/fs.js index a8436fba24d54c..5e132fe43cfb72 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -63,7 +63,7 @@ const { ERR_INVALID_ARG_VALUE, ERR_INVALID_ARG_TYPE, ERR_INVALID_CALLBACK, - ERR_OPTION_INCOMPATIBLE_WITH_PLATFORM + ERR_FEATURE_UNAVAILABLE_ON_PLATFORM }, uvException } = require('internal/errors'); @@ -1362,7 +1362,7 @@ function watch(filename, options, listener) { if (options.persistent === undefined) options.persistent = true; if (options.recursive === undefined) options.recursive = false; if (options.recursive && !(isOSX || isWindows)) - throw new ERR_OPTION_INCOMPATIBLE_WITH_PLATFORM('recursive'); + throw new ERR_FEATURE_UNAVAILABLE_ON_PLATFORM('watch recursively'); if (!watchers) watchers = require('internal/fs/watchers'); const watcher = new watchers.FSWatcher(); diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 7233c2c2c1e5ac..49fbc019ba20b0 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -803,6 +803,10 @@ E('ERR_FALSY_VALUE_REJECTION', function(reason) { this.reason = reason; return 'Promise was rejected with falsy value'; }, Error); +E('ERR_FEATURE_UNAVAILABLE_ON_PLATFORM', + (feature) => 'The feature ' + feature + + ' is unavailable to the current platform' + + ', which is being used to run Node.js', TypeError); E('ERR_FS_FILE_TOO_LARGE', 'File size (%s) is greater than 2 GB', RangeError); E('ERR_FS_INVALID_SYMLINK_TYPE', 'Symlink type must be one of "dir", "file", or "junction". Received "%s"', @@ -1201,10 +1205,6 @@ E('ERR_NO_CRYPTO', 'Node.js is not compiled with OpenSSL crypto support', Error); E('ERR_NO_ICU', '%s is not supported on Node.js compiled without ICU', TypeError); -E('ERR_OPTION_INCOMPATIBLE_WITH_PLATFORM', - (option) => 'The option ' + option + - 'is incompatible with the current platform' + - ',which is being used to run Node.js', TypeError); E('ERR_OUT_OF_RANGE', (str, range, input, replaceDefaultBoolean = false) => { assert(range, 'Missing "range" argument'); diff --git a/test/parallel/test-fs-watch-recursive.js b/test/parallel/test-fs-watch-recursive.js index ad41e1007a373f..a5094bc456ad21 100644 --- a/test/parallel/test-fs-watch-recursive.js +++ b/test/parallel/test-fs-watch-recursive.js @@ -51,6 +51,6 @@ try { } catch (err) { if (common.isOSX || common.isWindows) throw err; - else if (err.code !== 'ERR_OPTION_INCOMPATIBLE_WITH_PLATFORM') + else if (err.code !== 'ERR_FEATURE_UNAVAILABLE_ON_PLATFORM') throw err; } From 194ca4d73c8f109055d37b688502ea1a0046e8c7 Mon Sep 17 00:00:00 2001 From: Eran Levin Date: Sun, 13 Oct 2019 09:42:41 +0300 Subject: [PATCH 08/15] fix to documentation --- doc/api/fs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 3e481ac9c883f3..7fae9df9758aa5 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -3766,7 +3766,7 @@ The `fs.watch` API is not 100% consistent across platforms, and is unavailable in some situations. The recursive option is only supported on macOS and Windows. -An `ERR_OPTION_INCOMPATIBLE_WITH_PLATFORM` exception will be thrown, +An `ERR_FEATURE_UNAVAILABLE_ON_PLATFORM` exception will be thrown, if the option is used in an incompatible platform. #### Availability From a0b5dd5020e1fb5e25410ea6ea209c4ce80e9ca3 Mon Sep 17 00:00:00 2001 From: exx8 Date: Mon, 14 Oct 2019 15:38:55 +0300 Subject: [PATCH 09/15] Update doc/api/fs.md Co-Authored-By: Ben Noordhuis --- doc/api/fs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 7fae9df9758aa5..3c1e1a7b74ba6e 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -3766,7 +3766,7 @@ The `fs.watch` API is not 100% consistent across platforms, and is unavailable in some situations. The recursive option is only supported on macOS and Windows. -An `ERR_FEATURE_UNAVAILABLE_ON_PLATFORM` exception will be thrown, +An `ERR_FEATURE_UNAVAILABLE_ON_PLATFORM` exception will be thrown if the option is used in an incompatible platform. #### Availability From b0fc0ebb4187786d8f5bf7294db7acea17387a09 Mon Sep 17 00:00:00 2001 From: exx8 Date: Mon, 14 Oct 2019 15:39:13 +0300 Subject: [PATCH 10/15] Update doc/api/fs.md Co-Authored-By: Ben Noordhuis --- doc/api/fs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 3c1e1a7b74ba6e..9ed072ad1e4871 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -3767,7 +3767,7 @@ unavailable in some situations. The recursive option is only supported on macOS and Windows. An `ERR_FEATURE_UNAVAILABLE_ON_PLATFORM` exception will be thrown - if the option is used in an incompatible platform. +when the option is used on a platform that does not support it. #### Availability From cb2429734f311636845aeeb1fb372dab803de62f Mon Sep 17 00:00:00 2001 From: exx8 Date: Mon, 14 Oct 2019 15:39:23 +0300 Subject: [PATCH 11/15] Update lib/internal/errors.js Co-Authored-By: Ben Noordhuis --- lib/internal/errors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/errors.js b/lib/internal/errors.js index 49fbc019ba20b0..c0c2a163291fd7 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -805,7 +805,7 @@ E('ERR_FALSY_VALUE_REJECTION', function(reason) { }, Error); E('ERR_FEATURE_UNAVAILABLE_ON_PLATFORM', (feature) => 'The feature ' + feature + - ' is unavailable to the current platform' + + ' is unavailable on the current platform' + ', which is being used to run Node.js', TypeError); E('ERR_FS_FILE_TOO_LARGE', 'File size (%s) is greater than 2 GB', RangeError); E('ERR_FS_INVALID_SYMLINK_TYPE', From 7e23cef8fe1dacca38a882d5b2e98d5199316f58 Mon Sep 17 00:00:00 2001 From: Eran Levin Date: Tue, 15 Oct 2019 14:38:46 +0300 Subject: [PATCH 12/15] reformatting the error definition, and refactor the test --- lib/internal/errors.js | 6 +++--- test/parallel/test-fs-watch-recursive.js | 15 +++++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/internal/errors.js b/lib/internal/errors.js index c0c2a163291fd7..d90ea08d4dce13 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -804,9 +804,9 @@ E('ERR_FALSY_VALUE_REJECTION', function(reason) { return 'Promise was rejected with falsy value'; }, Error); E('ERR_FEATURE_UNAVAILABLE_ON_PLATFORM', - (feature) => 'The feature ' + feature + - ' is unavailable on the current platform' + - ', which is being used to run Node.js', TypeError); + 'The feature %s is unavailable on the current platform' + + ', which is being used to run Node.js', + TypeError); E('ERR_FS_FILE_TOO_LARGE', 'File size (%s) is greater than 2 GB', RangeError); E('ERR_FS_INVALID_SYMLINK_TYPE', 'Symlink type must be one of "dir", "file", or "junction". Received "%s"', diff --git a/test/parallel/test-fs-watch-recursive.js b/test/parallel/test-fs-watch-recursive.js index a5094bc456ad21..64c3b1520f775d 100644 --- a/test/parallel/test-fs-watch-recursive.js +++ b/test/parallel/test-fs-watch-recursive.js @@ -18,7 +18,15 @@ const testsubdir = fs.mkdtempSync(testDir + path.sep); const relativePathOne = path.join(path.basename(testsubdir), filenameOne); const filepathOne = path.join(testsubdir, filenameOne); -try { +if (!common.isOSX && !common.isWindows) { + common.expectsError(() => fs.watch(testDir, { recursive: true }), + { code: 'ERR_FEATURE_UNAVAILABLE_ON_PLATFORM' }); +} else { + + testWhenRecursiveIsImplemented(); +} + +function testWhenRecursiveIsImplemented() { const watcher = fs.watch(testDir, { recursive: true }); let watcherClosed = false; @@ -48,9 +56,4 @@ try { process.on('exit', function() { assert(watcherClosed, 'watcher Object was not closed'); }); -} catch (err) { - if (common.isOSX || common.isWindows) - throw err; - else if (err.code !== 'ERR_FEATURE_UNAVAILABLE_ON_PLATFORM') - throw err; } From 120a471861eefefbeee4d5a660889c44e13fe655 Mon Sep 17 00:00:00 2001 From: Eran Levin Date: Tue, 15 Oct 2019 17:43:10 +0300 Subject: [PATCH 13/15] updating test. --- test/parallel/test-fs-watch-recursive.js | 51 +++++++++++------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/test/parallel/test-fs-watch-recursive.js b/test/parallel/test-fs-watch-recursive.js index 64c3b1520f775d..add17f802a86f9 100644 --- a/test/parallel/test-fs-watch-recursive.js +++ b/test/parallel/test-fs-watch-recursive.js @@ -21,39 +21,34 @@ const filepathOne = path.join(testsubdir, filenameOne); if (!common.isOSX && !common.isWindows) { common.expectsError(() => fs.watch(testDir, { recursive: true }), { code: 'ERR_FEATURE_UNAVAILABLE_ON_PLATFORM' }); -} else { - - testWhenRecursiveIsImplemented(); + return; } +const watcher = fs.watch(testDir, { recursive: true }); -function testWhenRecursiveIsImplemented() { - const watcher = fs.watch(testDir, { recursive: true }); - - let watcherClosed = false; - watcher.on('change', function(event, filename) { - assert.ok(event === 'change' || event === 'rename'); - - // Ignore stale events generated by mkdir and other tests - if (filename !== relativePathOne) - return; +let watcherClosed = false; +watcher.on('change', function(event, filename) { + assert.ok(event === 'change' || event === 'rename'); - if (common.isOSX) { - clearInterval(interval); - } - watcher.close(); - watcherClosed = true; - }); + // Ignore stale events generated by mkdir and other tests + if (filename !== relativePathOne) + return; - let interval; if (common.isOSX) { - interval = setInterval(function() { - fs.writeFileSync(filepathOne, 'world'); - }, 10); - } else { - fs.writeFileSync(filepathOne, 'world'); + clearInterval(interval); } + watcher.close(); + watcherClosed = true; +}); - process.on('exit', function() { - assert(watcherClosed, 'watcher Object was not closed'); - }); +let interval; +if (common.isOSX) { + interval = setInterval(function() { + fs.writeFileSync(filepathOne, 'world'); + }, 10); +} else { + fs.writeFileSync(filepathOne, 'world'); } + +process.on('exit', function() { + assert(watcherClosed, 'watcher Object was not closed'); +}); From 632c0e1354d6483292bee010821a6358f6c2dc2d Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 24 Jan 2020 07:45:18 -0800 Subject: [PATCH 14/15] fixup! updating test. --- doc/api/errors.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/errors.md b/doc/api/errors.md index b4df10e2b0ed8e..18396f0ef8dfad 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -2413,7 +2413,7 @@ Used when an [ES Module][] loader hook specifies `format: 'dynamic'` but does not provide a `dynamicInstantiate` hook. -#### ERR_FEATURE_UNAVAILABLE_ON_PLATFORM +#### `ERR_FEATURE_UNAVAILABLE_ON_PLATFORM` Used when a feature that is not available to the current platform which is running Node.js is used. From b3db3446cfd63169babed9222876b05b92207715 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 24 Jan 2020 07:48:17 -0800 Subject: [PATCH 15/15] fixup! fixup! updating test. --- test/parallel/test-fs-watch-recursive.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-fs-watch-recursive.js b/test/parallel/test-fs-watch-recursive.js index add17f802a86f9..70b413814e78f4 100644 --- a/test/parallel/test-fs-watch-recursive.js +++ b/test/parallel/test-fs-watch-recursive.js @@ -19,8 +19,8 @@ const relativePathOne = path.join(path.basename(testsubdir), filenameOne); const filepathOne = path.join(testsubdir, filenameOne); if (!common.isOSX && !common.isWindows) { - common.expectsError(() => fs.watch(testDir, { recursive: true }), - { code: 'ERR_FEATURE_UNAVAILABLE_ON_PLATFORM' }); + assert.throws(() => { fs.watch(testDir, { recursive: true }); }, + { code: 'ERR_FEATURE_UNAVAILABLE_ON_PLATFORM' }); return; } const watcher = fs.watch(testDir, { recursive: true });