From 8720ac6634658f8d73a75421faeea4ea2a333c80 Mon Sep 17 00:00:00 2001 From: Zakariye Mohamed <168684030+zakiscoding@users.noreply.github.com> Date: Thu, 12 Mar 2026 14:42:50 -0400 Subject: [PATCH 1/2] test_runner: print failed coverage reports with dot runner Fixes: #60884 Refs: #52655 When running tests with both the dot reporter and coverage reports, if a coverage report fails (e.g., line coverage threshold not met), there was no visible output indicating the failure. The process would exit with a failure code, but only dots would be printed with no explanation. This commit adds collection and display of coverage threshold failure diagnostics in the dot reporter. When coverage threshold checks fail, error diagnostic messages are now displayed at the end of the test output, similar to how failed tests are displayed. The coverage error messages are collected from test:diagnostic events with level='error' that are emitted by the test runner when coverage thresholds are not met. --- lib/internal/test_runner/reporter/dot.js | 11 +++++++++++ 1 file changed, 11 insertions(+) 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() { From 5e8dfc3c77a3f25ac3009ed2ad960e59a2ddec66 Mon Sep 17 00:00:00 2001 From: Zakariye Mohamed <168684030+zakiscoding@users.noreply.github.com> Date: Thu, 12 Mar 2026 15:25:48 -0400 Subject: [PATCH 2/2] fix(os): return 'arm64' from os.machine() on Windows ARM64 (fix #62232) --- src/node_os.cc | 15 +++++++++ test/parallel/test-os-machine-arm64.js | 45 ++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 test/parallel/test-os-machine-arm64.js 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); +}