Skip to content

test: vitest testing setup - #19

Merged
robertraf merged 2 commits into
masterfrom
feat/vitest-coverage-and-game-tests
Mar 9, 2026
Merged

test: vitest testing setup#19
robertraf merged 2 commits into
masterfrom
feat/vitest-coverage-and-game-tests

Conversation

@robertraf

@robertraf robertraf commented Mar 9, 2026

Copy link
Copy Markdown
Owner

This pull request introduces a comprehensive testing setup using Vitest, adds initial unit tests for core game logic and data helpers, and integrates test coverage reporting into CI workflows. The changes also update the project configuration to support Vitest and coverage, and document new testing commands.

Testing infrastructure and configuration:

  • Added Vitest as the testing framework, along with coverage support via @vitest/coverage-v8. Updated vite.config.ts to use vitest/config and configured test environment and file inclusion. [1] [2] [3] [4]
  • Introduced new npm scripts for running tests, watching tests, and generating coverage reports in package.json.

CI integration:

  • Updated GitHub Actions workflows (deploy.yml and pr-preview.yml) to run tests with coverage as part of the CI process. [1] [2]

Unit tests for core logic:

  • Added tests for the game context reducer, including state loading, crafting, and battle rewards, in GameContext.reducer.test.ts. Exposed internal utilities for testing purposes. [1] [2]
  • Added tests for battle data helpers, including wave config scaling, equipment bonuses, and deterministic rewards, in battleData.test.ts.
  • Added tests for item data helpers, including artifact and equippable item identification, and item definition consistency, in gameData.test.ts.

Documentation:

  • Updated README.md to document new test commands (npm run test, npm run test:watch).

@github-actions

github-actions Bot commented Mar 9, 2026

Copy link
Copy Markdown

Preview deployment

URL https://pr-19.spacecraft-50l.pages.dev
Commit f522d1c
Status Ready

Deployment updated on every push to this PR.

@robertraf robertraf changed the title test: add Vitest coverage and game logic unit tests test: vitest testing setup Mar 9, 2026
@robertraf
robertraf merged commit dd4a935 into master Mar 9, 2026
1 check passed
@robertraf
robertraf deleted the feat/vitest-coverage-and-game-tests branch March 9, 2026 01:04
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