mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
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`. PR-URL: https://github.com/nodejs/node/pull/59254 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Stefan Stojanovic <stefan.stojanovic@janeasystems.com>
22 lines
506 B
JavaScript
22 lines
506 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const child = require('child_process');
|
|
|
|
if (!common.isWindows) {
|
|
common.skip('This test is specific to Windows to test winapi_strerror');
|
|
}
|
|
|
|
// Ref: https://github.com/nodejs/node/issues/23191
|
|
// This test is specific to Windows.
|
|
|
|
const cp = child.spawn('pwd');
|
|
|
|
cp.on('exit', common.mustCall(function() {
|
|
try {
|
|
process._debugProcess(cp.pid);
|
|
} catch (error) {
|
|
assert.strictEqual(error.errno, 2);
|
|
}
|
|
}));
|