Auto-run tests on playground load#138
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the playground’s first-load experience by automatically running the default tests as soon as the WASM discovery module is ready, and it updates pre-commit hooks to run ESLint/Prettier hermetically (without requiring bun or a pre-installed node_modules).
Changes:
- Auto-run tests once on initial playground load after WASM init (
Chrome.tsx). - Switch pre-commit ESLint/Prettier hooks to
language: nodewith pinnedadditional_dependencies. - Replace the playground ESLint flat config from ESM (
eslint.config.js) to CommonJS (eslint.config.cjs) so plugin resolution works in prek’s hermetic node environment.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| playground/src/Editor/Chrome.tsx | Adds a guarded effect that triggers an initial test run once WASM is ready. |
| playground/eslint.config.js | Removes the ESM flat config (replaced by CJS). |
| playground/eslint.config.cjs | Adds a CJS flat config compatible with prek’s NODE_PATH-based resolution. |
| .pre-commit-config.yaml | Updates ESLint/Prettier hooks to hermetic node environments with pinned deps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f50681c to
39a90c0
Compare
Kick off the first test run as soon as the WASM discovery module is ready, so the playground shows live results on load instead of an empty terminal. The run spins up the Pyodide worker itself, so execution starts the moment Python can run. Guarded by a ref so it fires only on the initial load. Also make the playground eslint/prettier pre-commit hooks hermetic: switch them from `bun run` (which needs bun + a local node_modules) to `language: node` with pinned `additional_dependencies`, mirroring the existing markdownlint-cli2 hook so prek installs the toolchain itself. The eslint flat config is converted to CommonJS (eslint.config.cjs) so it can resolve its plugins from prek's hermetic node env via NODE_PATH (ESM imports ignore NODE_PATH; require() honors it). Closes #137 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
39a90c0 to
242c80d
Compare
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.
Context
Closes #137 — when the playground loads, automatically run the tests instead of leaving an empty terminal until the user clicks Run.
Changes
playground/src/Editor/Chrome.tsx): a one-shot effect fireshandleRun()as soon as the WASM discovery module is ready. The run spins up the Pyodide worker itself, so execution starts the moment Python can run. AdidAutoRunRefguard ensures it fires only on the initial load, not on later re-renders/edits..pre-commit-config.yaml): theeslintandprettierhooks moved frombash -c 'cd playground && bun run …'(needsbun+ a pre-installednode_modules) tolanguage: nodewith pinnedadditional_dependencies, mirroring the existingmarkdownlint-cli2hook so prek installs the toolchain itself.playground/eslint.config.cjs, replacingeslint.config.js): required so the hook can resolve its plugins from prek's hermetic node env — prek exposes the env viaNODE_PATH, which ESM imports ignore butrequire()honors. ESLint still auto-discovers the.cjsconfig for localeslint src/, sobun run lintis unaffected.Test plan
uvx prek run eslint --all-files→ Passeduvx prek run prettier --all-files→ Passedeslint src/auto-discoverseslint.config.cjs(thelint/formatnpm scripts still work).tsc/Vite build wasn't run here — the WASM toolchain (wasm-pack,wasm32target) isn't available in this environment, and the change is a small isolated React effect that passes ESLint's rules-of-hooks/exhaustive-deps.🤖 Generated with Claude Code