Repository navigation
test(launcher): stop a Windows teardown turning a passing run red - #1988
Merged
lizhengfeng101 merged 1 commit intoNov 18, 2026
Merged
lizhengfeng101 merged 1 commit into
lizhengfeng101 merged 1 commit into
Conversation
On Windows the fixture binary is a copy of the running node executable, and the image stays mapped briefly after the process exits, so removing it can fail with EBUSY. Both removals now retry, and teardown no longer decides the exit code or replaces the run's own error. Signed-off-by: Abhishek Sharma <[email protected]>
Contributor
|
✅ OpenCodeReview: Review skipped: no items were selected. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #1987.
The
windowsjob fails after the launcher suite has printed every "passed" line it has, with no assertion having failed:createLauncherFixturecopies the running node executable to the fixture binary path on Windows, where POSIX gets a symlink, and the cases then run it. Windows keeps an executable's image mapped for a short time after the process that ran it exits, so removing it straight afterwards can fail withEBUSY. Two places remove it and either can meet the lock:testSpawnFailure'sunlinkSync, and thermSyncin thefinally.force: truedoes not help — it suppressesENOENT, notEBUSY.The stack above comes from the
finally, which means the real failure was intestSpawnFailureand the teardown error replaced it on the way out. That is the part that makes this hard to read: the error on screen is never the one that actually went wrong.What changed
Both removals retry.
fs.rmretries exactly this class of error whenmaxRetriesis set. It ignores the retry options unlessrecursiveis also set, even for a single file, so that is passed too — with a comment, because it reads like a mistake otherwise.Teardown no longer decides the exit code. Removing a temp directory is housekeeping, not an assertion about the launcher, so it cannot fail a run whose assertions all passed. And when the run did fail, the teardown error is printed beside the real one rather than replacing it.
The suite body moved into
runLauncherIntegrationTestsand the fixture lifecycle intorunWithTeardown, which takes the remover as a parameter so both outcomes can be tested without arranging a locked file.Type of Change
How Has This Been Tested?
node bin/ocr.test.jspasses on macOS. Three new assertions cover the teardown policy: a passing run stays passing when the fixture cannot be removed, a failing run still returns its own error, and the fixture is removed on the happy path. A fourth checks that the teardown failure is reported in both cases rather than swallowed — the point is to be quiet about it, not silent.Mutation-checked rather than assumed:
What I could not test: the retry itself. Reproducing the lock needs a Windows host, and I would rather say so than add a test that only asserts the option is present. The reasoning is the error in the CI log plus Node's documented retry behaviour for
EBUSY; the Windows job on this PR is the real check.I also left the file's existing formatting alone — Prettier reports the same issues on
mainand is not wired into CI, so reformatting would only add noise here.Checklist
AI/LLM Disclosure
Claude assisted with the investigation, the change, the tests and this description. The CI log reading, the mutation checks and the local test runs are from my own machine, and I have said plainly which part I could not verify.
Related Issues
Closes #1987