mirror of
https://github.com/nodejs/node.git
synced 2025-05-07 15:35:41 +00:00

Include the current working directory in the error message for a failing `process.chdir()` since that is usually information relevant for debugging. This is semver-major because it moves properties of the error message object. Inspired by https://github.com/nodejs/help/issues/1355. PR-URL: https://github.com/nodejs/node/pull/21526 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
20 lines
414 B
JavaScript
20 lines
414 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.isMainThread)
|
|
common.skip('process.chdir is not available in Workers');
|
|
|
|
common.expectsError(
|
|
() => {
|
|
process.chdir('does-not-exist');
|
|
},
|
|
{
|
|
type: Error,
|
|
code: 'ENOENT',
|
|
message: /ENOENT: no such file or directory, chdir .+ -> 'does-not-exist'/,
|
|
path: process.cwd(),
|
|
syscall: 'chdir',
|
|
dest: 'does-not-exist'
|
|
}
|
|
);
|