Skip to content

Find the tests in the test file with acorn - #1046

Draft
exercism-agent[bot] wants to merge 1 commit into
mainfrom
find-tests-with-acorn
Draft

exercism-agent[bot] wants to merge 1 commit into
mainfrom
find-tests-with-acorn

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 makes this project around 20% 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 is the first of two draft PRs. Merge this one first, then #1047, which runs the tests with Node's built-in test runner. This one also works on its own.

What changed

After the tests run, the reporter parses the test file to show each test's code, find its task ID and work out which test printed each console message. It did this with @exercism/static-analysis, which uses @typescript-eslint/typescript-estree. That package loads the whole TypeScript compiler on every run, which took about 0.4s.

The reporter now parses the test file with acorn, a small JavaScript parser, in a new src/tests.ts. On all 180 test files in the track and the runner's fixtures, it finds the same test names, task IDs, test code and locations as before.

@exercism/static-analysis, @typescript-eslint/typescript-estree and @typescript-eslint/visitor-keys are no longer dependencies. Students will see no change in results or messages.

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

🤖 Generated with Claude Code

The reporter parsed the test file with @exercism/static-analysis, which uses @typescript-eslint/typescript-estree and so loads the whole TypeScript compiler on every run. Test files are plain JavaScript, so acorn reads them as well. On all 180 spec files in the track and the fixtures, the new code finds the same tests, names, task IDs, code and locations.

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