Skip to content

Commit 2219404

Browse files
committed
test: make test-debug-process locale-independent
The test `test/parallel/test-debug-process.js` fails on non-English Windows systems due to a locale-dependent error message string. The test asserts that a call to `process._debugProcess()` on a terminated process throws an error with the message `'The system cannot find the file specified.'`. While this holds true on an English Windows system, the test fails on systems with a different display language. The underlying `WinapiErrnoException` function correctly retrieves the localized error message from the OS. For example, on a Korean system, the message is "์ง€์ •๋œ ํŒŒ์ผ์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.". This mismatch causes an `AssertionError`. This behavior can be verified directly in PowerShell: # On Windows with English (US) display language PS> (New-Object System.ComponentModel.Win32Exception 2).Message The system cannot find the file specified. # On Windows with Korean display language PS> (New-Object System.ComponentModel.Win32Exception 2).Message ์ง€์ •๋œ ํŒŒ์ผ์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. To make the test robust and environment-agnostic, this commit changes the assertion to check the language-independent `error.errno` property, which is consistently `2` for this type of error, instead of the localized `error.message`.
1 parent 34cfc5a commit 2219404

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

โ€Žtest/parallel/test-debug-process.jsโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ cp.on('exit', common.mustCall(function() {
1616
try {
1717
process._debugProcess(cp.pid);
1818
} catch (error) {
19-
assert.strictEqual(error.message, 'The system cannot find the file specified.');
19+
assert.strictEqual(error.errno, 2);
2020
}
2121
}));

0 commit comments

Comments
ย (0)