Skip to content

Commit cf8512d

Browse files
committed
fix: make dedup test platform-aware for Windows PATHEXT
On Windows, findOnPath checks 4 candidate names per directory (patchloom.exe, .cmd, .bat, patchloom) via PATHEXT. The dedup test asserted exactly 1 fs.access call, which is correct on Unix but fails on Windows where 4 candidates are checked per unique directory. Make the expected count platform-aware: 4 on Windows, 1 elsewhere. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
1 parent 3519339 commit cf8512d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

test/unit/binaryDiscovery.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ test("findOnPath deduplicates PATH entries", async () => {
7979
});
8080

8181
assert.equal(found, fakeBinary);
82-
assert.equal(checkCount, 1, "should only check each directory once");
82+
// On Windows, findOnPath checks 4 candidate names per directory
83+
// (patchloom.exe, .cmd, .bat, patchloom); on Unix just 1.
84+
// Dedup reduces 3 identical dirs to 1, so: 4 checks (win) or 1 (unix).
85+
const expectedChecks = process.platform === "win32" ? 4 : 1;
86+
assert.equal(checkCount, expectedChecks, "should only check each directory once");
8387
});
8488
});
8589

0 commit comments

Comments
 (0)