From 0f4ce0825d6a72ecb2659b695253ad6a14f92291 Mon Sep 17 00:00:00 2001 From: Junior-HJ <112132647+Junior-HJ@users.noreply.github.com> Date: Mon, 5 Oct 2026 12:08:01 -0500 Subject: [PATCH] test(compression): make worker-specifier and RTK TOML assertions cross-platform The llmlingua worker-specifier test compared URL.pathname to a POSIX literal, which fails on Windows where pathToFileURL resolves to /D:/app/... . The RTK TOML install test asserted 0600 mode bits, which Windows does not implement. Both were test-only bugs; no production code changed. Compare the pathname through pathToFileURL(path.resolve(...)) and gate the mode check on POSIX like tests/unit/data-dir-private-perms.test.ts already does. --- changelog.d/fixes/0000-windows-compression-tests.md | 1 + tests/unit/compression/compression-worker-pool-jam.test.ts | 4 +++- tests/unit/compression/rtk-toml-compatibility.test.ts | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 changelog.d/fixes/0000-windows-compression-tests.md diff --git a/changelog.d/fixes/0000-windows-compression-tests.md b/changelog.d/fixes/0000-windows-compression-tests.md new file mode 100644 index 000000000000..6281f3783db5 --- /dev/null +++ b/changelog.d/fixes/0000-windows-compression-tests.md @@ -0,0 +1 @@ +- **fix(tests):** Compression worker-pool and RTK TOML test assertions now cross-platform — worker specifier compares URL pathnames via `pathToFileURL`, and the 0600 permission check is POSIX-only. Both failures were Windows-only test bugs, not runtime regressions. diff --git a/tests/unit/compression/compression-worker-pool-jam.test.ts b/tests/unit/compression/compression-worker-pool-jam.test.ts index 4bd1a83e3e17..d12c3d464c65 100644 --- a/tests/unit/compression/compression-worker-pool-jam.test.ts +++ b/tests/unit/compression/compression-worker-pool-jam.test.ts @@ -1,6 +1,8 @@ import assert from "node:assert/strict"; import { EventEmitter } from "node:events"; +import path from "node:path"; import { after, describe, it } from "node:test"; +import { pathToFileURL } from "node:url"; import type { Worker } from "node:worker_threads"; import { __setCompressionWorkerFactoryForTests, @@ -602,7 +604,7 @@ describe("llmlingua worker spawn specifier", () => { const specifier = llmlinguaWorkerSpecifier("/app/onnxWorker.js"); assert.ok(specifier instanceof URL, "Worker entry must be a URL object, not a string"); assert.equal(specifier.protocol, "file:"); - assert.equal(specifier.pathname, "/app/onnxWorker.js"); + assert.equal(specifier.pathname, pathToFileURL(path.resolve("/app/onnxWorker.js")).pathname); }); }); diff --git a/tests/unit/compression/rtk-toml-compatibility.test.ts b/tests/unit/compression/rtk-toml-compatibility.test.ts index cc5b9cacef0c..891c93f08ca3 100644 --- a/tests/unit/compression/rtk-toml-compatibility.test.ts +++ b/tests/unit/compression/rtk-toml-compatibility.test.ts @@ -240,7 +240,9 @@ match_command = "^scope-tool" assert.equal(installed.installedPath, "rtk/filters.toml"); assert.equal(fs.readFileSync(target, "utf8"), SAMPLE); - assert.equal(fs.statSync(target).mode & 0o777, 0o600); + if (process.platform !== "win32") { + assert.equal(fs.statSync(target).mode & 0o777, 0o600); + } assert.throws( () => installGlobalRtkTomlV1(SAMPLE), (error: unknown) =>