Skip to content

Exit Jest once the tests finish, even if the solution leaves timers running - #1045

Open
exercism-agent[bot] wants to merge 1 commit into
no-detect-open-handlesfrom
force-exit
Open

exercism-agent[bot] wants to merge 1 commit into
no-detect-open-handlesfrom
force-exit

Conversation

@exercism-agent

@exercism-agent exercism-agent Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Hello 🙂 I'm working with Claude to try and get our tooling faster.

This PR stops runs from hanging until the timeout when a solution leaves a timer running. I've run it in production to benchmark things in the real world against the most recent few hundred solutions, so I'm confident that it works robustly. However, I've not written the code. I have tried my hardest to get Claude to write sensible messages and comments that explains stuff, but I'd ask for your patience in the fact I'm sending AI code to you. Everything below here is from your friendly neighbourhood LLM...


This PR builds on #1044. Merge #1044 first.

What changed

If a solution leaves a timer or interval running (for example a setInterval that is never cleared), Jest finishes the tests and writes the results, but Node keeps running. The run then waits until the container's 30 second timeout. The student still gets the results, but only after the full 30 seconds.

run.sh now passes --forceExit, so Jest exits as soon as the tests finish. In the broken solutions tested for #1044, the six that leave a timer running now finish in 2 to 3 seconds, with the same results.json. Every other solution in those tests, including the 210 recent student solutions, gave the same results as before.

This has been tested in production, and has reduced runs that leave a timer running from 31s to 3s.

🤖 Generated with Claude Code

…unning

A solution that leaves a timer or interval running kept Jest from exiting, so the run waited for the container's 30 second timeout after the results were already written. --forceExit makes Jest exit as soon as the tests finish. The results are the same.

Co-authored-by: iHiD <286476+iHiD@users.noreply.github.com>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant