test: add vitest with a sample TimeModel suite - #6
Merged
Conversation
New sims forked from the template are now testable by default and contribute to the fleet-wide CI/fleet-health test step. Mirrors the vitest + happy-dom setup used by OpticsLab/Resonance: a canonical tests/setup.ts that mocks Canvas2D + AudioContext and calls SceneryStack init(), plus a passing TimeModel.test.ts as a starting point. Also fixes the pre-existing biome useBlockStatements/noShadow errors in scripts/rename-sim.ts that gated the repo-wide pre-commit hook. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Dependency ReviewThe following issues were found:
OpenSSF ScorecardScorecard details
Scanned Files
|
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.
What
Makes the canonical sim template testable by default, so new sims forked from it contribute to the fleet-wide CI/fleet-health
teststep (see OpenPhysics/Baton#3).vitest+happy-domdev dependencies andtest/test:watchscripts (matches OpticsLab/Resonance, vitest ^4.1.8).vitest.config.tsand a canonicaltests/setup.tsthat mocks Canvas2D + AudioContext and calls SceneryStackinit()— copy as-is when forking, changing only thename.tests/TimeModel.test.ts— a passing 5-case suite covering the composable play/pause + elapsed-time model.useBlockStatements/noShadowerrors inscripts/rename-sim.tsthat were gating the repo-wide pre-commit hook.Verification
npm test→ 5 passed.npm run lintandnpm run checkclean (tsconfigincludes onlysrc, so tests don't affect type-check, matching OpticsLab).🤖 Generated with Claude Code