diff options
author | bcoe <bencoe@google.com> | 2020-10-09 03:17:01 +0300 |
---|---|---|
committer | Benjamin Coe <bencoe@google.com> | 2020-10-14 01:04:57 +0300 |
commit | 7d6672226b93f49d823cd58359f4b2331ca712f5 (patch) | |
tree | 2081842f5b6e292a6351438dcc90b8a82ff931e4 /test | |
parent | d7e5d656ea4252231d77de04dc1aa04fcc72abe4 (diff) |
fs: rimraf should not recurse on failure
PR-URL: https://github.com/nodejs/node/pull/35566
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/known_issues/known_issues.status | 3 | ||||
-rw-r--r-- | test/parallel/test-fs-open-no-close.js (renamed from test/known_issues/test-fs-open-no-close.js) | 7 | ||||
-rw-r--r-- | test/parallel/test-fs-rmdir-recursive.js | 25 |
3 files changed, 26 insertions, 9 deletions
diff --git a/test/known_issues/known_issues.status b/test/known_issues/known_issues.status index 01a82246c93..e0f0a456089 100644 --- a/test/known_issues/known_issues.status +++ b/test/known_issues/known_issues.status @@ -1,3 +1,4 @@ + prefix known_issues # If a known issue does not apply to a platform, list the test name in the @@ -27,5 +28,3 @@ test-vm-timeout-escape-queuemicrotask: SKIP # The Raspberry Pis are too slow to run this test. # See https://github.com/nodejs/build/issues/2227#issuecomment-608334574 test-crypto-authenticated-stream: SKIP -# The bug being checked is that the test never exits. -test-fs-open-no-close: TIMEOUT diff --git a/test/known_issues/test-fs-open-no-close.js b/test/parallel/test-fs-open-no-close.js index ef990d1a67d..5e432dd11d8 100644 --- a/test/known_issues/test-fs-open-no-close.js +++ b/test/parallel/test-fs-open-no-close.js @@ -4,14 +4,7 @@ // Failing to close a file should not keep the event loop open. const common = require('../common'); - -// This issue only shows up on Raspberry Pi devices in our CI. When this test is -// moved out of known_issues, this check can be removed, as the test should pass -// on all platforms at that point. const assert = require('assert'); -if (process.arch !== 'arm' || process.config.variables.arm_version > 7) { - assert.fail('This test is for Raspberry Pi devices in CI'); -} const fs = require('fs'); diff --git a/test/parallel/test-fs-rmdir-recursive.js b/test/parallel/test-fs-rmdir-recursive.js index 1d2525a5ed6..bbf89a3959e 100644 --- a/test/parallel/test-fs-rmdir-recursive.js +++ b/test/parallel/test-fs-rmdir-recursive.js @@ -211,3 +211,28 @@ function removeAsync(dir) { message: /^The value of "options\.maxRetries" is out of range\./ }); } + +// It should not pass recursive option to rmdirSync, when called from +// rimraf (see: #35566) +{ + // Make a non-empty directory: + const original = fs.rmdirSync; + const dir = `${nextDirPath()}/foo/bar`; + fs.mkdirSync(dir, { recursive: true }); + fs.writeFileSync(`${dir}/foo.txt`, 'hello world', 'utf8'); + + // When called the second time from rimraf, the recursive option should + // not be set for rmdirSync: + let callCount = 0; + let rmdirSyncOptionsFromRimraf; + fs.rmdirSync = (path, options) => { + if (callCount > 0) { + rmdirSyncOptionsFromRimraf = { ...options }; + } + callCount++; + return original(path, options); + }; + fs.rmdirSync(dir, { recursive: true }); + fs.rmdirSync = original; + assert.strictEqual(rmdirSyncOptionsFromRimraf.recursive, undefined); +} |