diff --git a/lib/internal/test_runner/reporter/dot.js b/lib/internal/test_runner/reporter/dot.js index 45ff047bc4e5a0..c3f99ee9c525fa 100644 --- a/lib/internal/test_runner/reporter/dot.js +++ b/lib/internal/test_runner/reporter/dot.js @@ -10,6 +10,7 @@ module.exports = async function* dot(source) { let count = 0; let columns = getLineLength(); const failedTests = []; + const coverageErrors = []; for await (const { type, data } of source) { if (type === 'test:pass') { yield `${colors.green}.${colors.reset}`; @@ -18,6 +19,10 @@ module.exports = async function* dot(source) { yield `${colors.red}X${colors.reset}`; ArrayPrototypePush(failedTests, data); } + if (type === 'test:diagnostic' && data.level === 'error') { + // Collect coverage errors (coverage threshold failures) + ArrayPrototypePush(coverageErrors, data.message); + } if ((type === 'test:fail' || type === 'test:pass') && ++count === columns) { yield '\n'; @@ -33,6 +38,12 @@ module.exports = async function* dot(source) { yield formatTestReport('test:fail', test); } } + if (coverageErrors.length > 0) { + yield `\n${colors.red}Coverage errors:${colors.white}\n\n`; + for (const error of coverageErrors) { + yield `${colors.red}${error}${colors.white}\n`; + } + } }; function getLineLength() { diff --git a/src/node_os.cc b/src/node_os.cc index 4c7ebde4644fb2..a06995ab2322e8 100644 --- a/src/node_os.cc +++ b/src/node_os.cc @@ -91,6 +91,21 @@ static void GetOSInformation(const FunctionCallbackInfo& args) { return; } +#ifdef _WIN32 + // On Windows, uv_os_uname may return "unknown" for the machine field on ARM64. + // Try to detect the processor architecture via Windows APIs. + if (strcmp(info.machine, "unknown") == 0) { + SYSTEM_INFO sys_info; + GetSystemInfo(&sys_info); + + // Map Windows processor architecture to machine designations + // PROCESSOR_ARCHITECTURE_ARM64 = 12 + if (sys_info.wProcessorArchitecture == 12) { + snprintf(info.machine, sizeof(info.machine), "arm64"); + } + } +#endif + // [sysname, version, release, machine] Local osInformation[4]; if (String::NewFromUtf8(env->isolate(), info.sysname) diff --git a/test/parallel/test-os-machine-arm64.js b/test/parallel/test-os-machine-arm64.js new file mode 100644 index 00000000000000..21e8fe75b899d0 --- /dev/null +++ b/test/parallel/test-os-machine-arm64.js @@ -0,0 +1,45 @@ +'use strict'; + +// Test for Windows ARM64 os.machine() detection fix +// When on Windows ARM64, os.machine() should return 'arm64' instead of 'unknown' + +const common = require('../common'); +const assert = require('assert'); +const os = require('os'); + +// os.machine() should return a string +const machine = os.machine(); +assert.strictEqual(typeof machine, 'string'); +assert.ok(machine.length > 0, 'os.machine() should not be empty'); + +// Verify it returns a recognized architecture string +// Valid values include: x64, x32, ia32, arm, arm64, ppc64, ppc64le, s390, s390x, mips, mips64el, riscv64, loong64, unknown +const validArchitectures = [ + 'unknown', + 'x64', + 'x32', + 'ia32', + 'arm', + 'arm64', + 'ppc64', + 'ppc64le', + 's390', + 's390x', + 'mips', + 'mips64el', + 'riscv64', + 'loong64', +]; + +assert.ok( + validArchitectures.includes(machine), + `os.machine() returned "${machine}", but should be one of: ${validArchitectures.join(', ')}` +); + +// On Windows systems, specifically verify that os.machine() doesn't return 'unknown' +// if the system is actually ARM64 capable (this fix ensures GetSystemInfo() is used) +if (common.isWindows) { + // This test will pass on all Windows systems. The fix ensures that on ARM64 systems, + // os.machine() no longer returns 'unknown', but instead returns 'arm64' + assert.ok(machine.length > 0); +}