Version
v23.0.0
Platform
Linux {HOSTNAME} 5.15.0-117-generic #127-Ubuntu SMP Fri Jul 5 20:13:28 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
Welcome to Node.js v23.0.0.
Type ".help" for more information.
require('path').resolve('/tmp/jest-changed-files-test-dir/nested-dir/second-nested-dir', '../../')
'/tmp/jest-changed-files-test-dir/'
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior? Why is that the expected behavior?
The trailing slash should be stripped, as noted in the docs:
The resulting path is normalized and trailing slashes are removed unless the path is resolved to the root directory
Indeed the example in the docs themselves does not materialize in Node 23.
path.resolve('/foo/bar', '/tmp/file/');
// Returns: '/tmp/file'
It actually returns /tmp/file/.
What do you see instead?
The trailing slash is not stripped.
Additional information
No response
Version
v23.0.0
Platform
Subsystem
No response
What steps will reproduce the bug?
Welcome to Node.js v23.0.0.
Type ".help" for more information.
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior? Why is that the expected behavior?
The trailing slash should be stripped, as noted in the docs:
Indeed the example in the docs themselves does not materialize in Node 23.
It actually returns
/tmp/file/.What do you see instead?
The trailing slash is not stripped.
Additional information
No response