Skip to content

Report missing tests from the main Jest run (~12% faster) - #1039

Merged
SleeplessByte merged 2 commits into
mainfrom
skip-list-tests
Nov 19, 2026
Merged

SleeplessByte merged 2 commits into
mainfrom
skip-list-tests

Conversation

@ihid-assistant

@ihid-assistant ihid-assistant Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

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

This PR makes this project around 12% faster. 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 follows #1038, which is now merged.

What changed

Before the real test run, run.sh started Jest a first time with --listTests, only to check that the solution has at least one test file. Each Jest start costs about 0.3 seconds.

Now Jest starts once. If it finds no test files, the reporter writes the same error as before: status error, with the message "The submitted code was not subjected to any type or execution tests. At least one test was expected."

The check now also uses the same Jest config as the real run. The --listTests run picked up the exercise's jest.config.js, which has different test patterns from jest.runner.config.js.

This removes about 60 lines from run.sh.

This has been tested in production, and has reduced the median run from 2.7s to 2.4s.

🤖 Generated with Claude Code

@ihid-assistant
ihid-assistant Bot requested a review from a team as a code owner November 18, 2026 16:55
@SleeplessByte

Copy link
Copy Markdown
Member

The babel etc. stuff used to be necessary to run the tests on exercises that required babel. Is that no longer needed and does pnpm just pick it up? Also, version 3 wasn't allowed to list an empty array of tests with a message, that's why it was using version 1 for such an output. Is this no longer the case?

@ihid-assistant

Copy link
Copy Markdown
Contributor Author

The Babel setup is unchanged. run.sh still swaps in the runner's babel.config.js and package.json before Jest runs. The lines I removed were the copy of the "restore the student's config files" block inside the early exit. With the early exit gone, the no-tests case falls through to the same restore block at the end that every other run uses. I re-ran examples that rely on Babel (ESM everywhere, private class fields in game-of-life, jest.fn/jest.spyOn in fruit-picker and coordinate-transformation, async in translation-service) and they pass as on main.

You're right about the version. The reporter was writing version 3 with "tests": []. I've changed it so the no-tests case writes exactly what main wrote: { "version": 1, "status": "error", "message": "The submitted code was not subjected to any type or execution tests. At least one test was expected." }, with no tests key.

@SleeplessByte

Copy link
Copy Markdown
Member

Can you keep a variant for debugging, or add a flag so the speed-up is there in prod but we can still get this output? It will be important when at some point it breaks.

Base automatically changed from faster-test-runs to main November 19, 2026 21:32
iHiD and others added 2 commits November 20, 2026 06:33
…istTests run

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Version 3 results can't have an empty list of tests, so when Jest finds
no test files the reporter now writes exactly what run.sh wrote before:
version 1, status "error" and the same message, with no tests key.

Co-authored-by: iHiD <286476+iHiD@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SleeplessByte

Copy link
Copy Markdown
Member

Actually I don't care, because then I need to explain why we had this in the first place.

@SleeplessByte
SleeplessByte merged commit f8844c3 into main Nov 19, 2026
7 checks passed
@SleeplessByte
SleeplessByte deleted the skip-list-tests branch November 19, 2026 21:40
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.

2 participants