-
-
Notifications
You must be signed in to change notification settings - Fork 34.3k
Description
Version
v26.0.0-pre
Platform
Linux tumba 6.18.3-gentoo-yuran #1 SMP Sun Jan 4 21:50:21 +08 2026 x86_64 Intel(R) Core(TM)2 Quad CPU Q8200 @ 2.33GHz GenuineIntel GNU/Linux
Subsystem
test
What steps will reproduce the bug?
# cd /
# git clone --depth=1 https://github.com/nodejs/node.git
# cd node
# ./configure && make test-onlyIn realistic scenarios, cd / is implicit: for example, right after chroot or pivot_root into disposable environment.
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior? Why is that the expected behavior?
All tests are expected to pass.
What do you see instead?
A bunch of failing tests. Assertions are failing with something like:
+ '(node:*) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https:*js.org*api*cli.html#cli_unhandled_rejections_mode). (rejection id: 1)\n'
- '(node:*) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https:*nodejs.org*api*cli.html#cli_unhandled_rejections_mode). (rejection id: 1)\n' 'Error: an error!\n' +
+ ' at functionD (*/test/fixtures/source-map*_modules/error-stack/enclosing-call-site.js:16:17)\n' +
+ ' at functionC (*/test/fixtures/source-map*_modules/error-stack/enclosing-call-site.js:10:3)\n' +
+ ' at functionB (*/test/fixtures/source-map*_modules/error-stack/enclosing-call-site.js:6:3)\n' +
+ ' at functionA (*/test/fixtures/source-map*_modules/error-stack/enclosing-call-site.js:2:3)\n' +
+ ' at Object.<anonymous> (*/test/fixtures/source-map*_modules/error-stack/enclosing-call-site.js:24:3)\n' +
- ' at functionD (*/test/fixtures/source-map/node_modules/error-stack/enclosing-call-site.js:16:17)\n' +
- ' at functionC (*/test/fixtures/source-map/node_modules/error-stack/enclosing-call-site.js:10:3)\n' +
- ' at functionB (*/test/fixtures/source-map/node_modules/error-stack/enclosing-call-site.js:6:3)\n' +
- ' at functionA (*/test/fixtures/source-map/node_modules/error-stack/enclosing-call-site.js:2:3)\n' +
- ' at Object.<anonymous> (*/test/fixtures/source-map/node_modules/error-stack/enclosing-call-site.js:24:3)\n' +
'Error: an error!\n' +
+ ' at functionD (*/test/fixtures/source-map*_modules/error-stack/enclosing-call-site-min.js:1:156)\n' +
+ ' at functionC (*/test/fixtures/source-map*_modules/error-stack/enclosing-call-site-min.js:1:97)\n' +
+ ' at functionB (*/test/fixtures/source-map*_modules/error-stack/enclosing-call-site-min.js:1:60)\n' +
+ ' at functionA (*/test/fixtures/source-map*_modules/error-stack/enclosing-call-site-min.js:1:26)\n' +
+ ' at Object.<anonymous> (*/test/fixtures/source-map*_modules/error-stack/enclosing-call-site-min.js:1:199)\n'
- ' at functionD (*/test/fixtures/source-map/node_modules/error-stack/enclosing-call-site-min.js:1:156)\n' +
- ' at functionC (*/test/fixtures/source-map/node_modules/error-stack/enclosing-call-site-min.js:1:97)\n' +
- ' at functionB (*/test/fixtures/source-map/node_modules/error-stack/enclosing-call-site-min.js:1:60)\n' +
- ' at functionA (*/test/fixtures/source-map/node_modules/error-stack/enclosing-call-site-min.js:1:26)\n' +
- ' at Object.<anonymous> (*/test/fixtures/source-map/node_modules/error-stack/enclosing-call-site-min.js:1:199)\n'Additional information
The reason is that the tests simply remove matches to process.cwd(). In the examples above, CWD being /node corrupts http://nodejs.org and /node_modules.
Obviously there are other directories that may break tests, e.g. /test.
List of tests :
-
test/parallel/test-node-output-v8-warning.mjs -
test/parallel/test-node-output-vm.mjs -
test/parallel/test-node-output-console.mjs -
test/parallel/test-node-output-sourcemaps.mjs -
test/parallel/test-node-output-errors.mjs
Also the most edge case is CWD being /, assuming no conflict with /lib. In this case, additional failing tests are:
-
test/parallel/test-cli-permission-deny-fs.js- has skips if founds itself in/etcbut doesn't check if it's even worse. -
test/es-module/test-esm-import-meta.mjs- uses regexps that assume that leading/and/test...are not overlapped.
All of the above might be a valid
good first issue
And then there are at least these tests in test-runner that validate test output, using common/assertSnapshot.js to normalize it:
test/test-runner/test-output-abort-runs-after-hook.mjstest/test-runner/test-output-abort-hooks.mjstest/test-runner/test-output-abort-suite.mjstest/test-runner/test-output-abort.mjstest/test-runner/test-output-filtered-suite-throws.mjstest/test-runner/test-output-default-output.mjstest/test-runner/test-output-global-after-should-fail-the-test.mjstest/test-runner/test-output-source-mapped-locations.mjstest/test-runner/test-output-describe-it.mjstest/test-runner/test-output-test-runner-plan.mjstest/test-runner/test-output-hooks.mjstest/test-runner/test-output-test-timeout-flag.mjstest/test-runner/test-output-output.mjstest/test-runner/test-output-unfinished-suite-async-error.mjstest/test-runner/test-output-test-timeout-flag-with-test.mjstest/test-runner/test-output-timeout-in-before-each.mjstest/test-runner/test-output-test-runner-plan-timeout.mjstest/test-runner/test-output-lcov-reporter.mjstest/test-runner/test-output-output-cli.mjs
Adjusting them individually would be an exercise in futility, so it's just an extra in case of bright ideas on making transformations from assertSnapshot more strict&robust and unify test-node-output-* as well.