One unloadable test file no longer takes down the whole run - #184
Open
DmitrySharabin wants to merge 1 commit into
Open
DmitrySharabin wants to merge 1 commit into
DmitrySharabin wants to merge 1 commit into
Conversation
A test file that could not be imported killed the process before any test ran. It now becomes a failing test, so the existing stats and exit-code paths report it and healthy files still run. Under --watch, rerun() swaps in that failing test rather than keeping the stale passing subtree. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RaXmFiBg3UGUMuGFXjn5Ki
✅ Deploy Preview for h-test ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
A test file that cannot be imported — a missing dependency, a syntax error — used to kill the process with a raw unhandled-rejection stack before any test ran, including the healthy files beside it.
Two paths handled it, both wrong, in opposite directions:
getTestsInloggedError importing tests from …— but the tagging loop at the end ofresolveLocationthen re-imported the same file with a bareimport(url), and that rejection killed the process anyway. The handler was effectively dead code. The glob branch had no handler at all.--watch.rerun()logged to a console the alt screen paints over and kept the stale passing subtree, so a file that broke while you watched it stayed green until the next successful save.The change
An unloadable file becomes a failing test:
That is the whole design. The exit code comes from the existing
stats.fail > 0 ? 1 : 0line, the error renders in the tree where interactive mode can actually show it, and--watchrecovery works because fixing the file is just another re-run. No new state, no new exit-code plumbing, no console channel that the alt screen hides.importTests(url, base)replaces the two near-duplicate import sites, so the load-failure policy has one owner.Verification
122/122. Both new assertions go red against the unfixed runner, and the plausible wrong fix — log the error, drop the file — is caught too: it yields1/1 PASSand exit 0.Exit 1 and a correct
broken.jslabel for a directory,dir/*.js, and a bare*.js.--watchchecked expanded in tmux across five transitions: broken on first run → fixed → re-broken → broken again while broken → deleted.The tests deliberately spawn from
run()rather thanbeforeAll(): a throwingbeforeAlldegrades its children to SKIP, and a skipped test cannot fail CI. With an injected fixture fault they now report2/2 FAILand exit 1 instead of a green13/13 skipped.Diff stats
Substantive lines only (blank- and comment-only changes excluded).
src/env/node.jstests/run.jsNot covered
The
rerun()half is verified by hand, not by the suite — there is no pty/watch harness, andrerunhas no seam (module-private, needscurrentRoot,isInteractive, watchers and debounce timing). A refactor ofreruncould reintroduce the stale-green bug with the suite still green.Out of scope
"type": "module") with a syntax error still hard-crashes: Node's module-detection retry rejects a promise hTest never receives. Unchanged frommain.**/*.jsyieldsbase = "**", so labels read../broken.js. Pre-existingpath.dirname(location)behavior, now also reaching failing-test names.Errorcrashes the runner the same way — same family of bug, different cause. Filed as Throwing a non-Error crashes the runner and takes down the whole run #183.🤖 Generated with Claude Code
https://claude.ai/code/session_01RaXmFiBg3UGUMuGFXjn5Ki