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) =>