feat: add vitest test runner with fixture loader and mock activation#260
Merged
snipcodeit merged 1 commit intomainfrom Mar 6, 2026
Merged
Conversation
Configures vitest as the primary test runner for the v6 Local Testing & Simulation Framework (Phase 47: Mock Infrastructure, issue #249). Changes: - package.json: add vitest ^2.0.0 devDependency; npm test → vitest run; npm run test:watch → vitest; npm run test:node preserves existing node --test runner for .test.cjs files - vitest.config.js: node environment, setupFiles: ['./test/setup.js'], includes .test.js/.spec.js, excludes .test.cjs (node:test incompatible) - test/setup.js: auto-activates mock-github and mock-gsd-agent in beforeEach/afterEach; conditional require — works when PRs #258/#259 are not yet merged to main; exports mockGitHub/mockGsdAgent - test/loadFixture.js: loadFixture(name) helper that reads from test/fixtures/; supports namespaced paths (e.g. 'github/issue-view'); throws descriptive errors on missing/invalid fixtures Closes #249 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 task
snipcodeit
pushed a commit
that referenced
this pull request
Mar 6, 2026
…cycle (#250) Adds test/validate-and-load.test.js with 23 vitest integration tests (5 groups) covering fresh .mgw/ init, migrateProjectState() idempotency, loadActiveIssue() prefix pattern, staleness detection via mock-github.cjs, and loadCrossRefs() validation — all isolated in tmp directories via process.cwd() override. Also includes vitest infrastructure (vitest.config.js, test/setup.js, test/loadFixture.js, test/fixtures/github/) from PRs #247 and #260 required to run the test suite. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Mar 6, 2026
snipcodeit
pushed a commit
that referenced
this pull request
Mar 6, 2026
…cycle (#250) Adds test/validate-and-load.test.js with 23 vitest integration tests (5 groups) covering fresh .mgw/ init, migrateProjectState() idempotency, loadActiveIssue() prefix pattern, staleness detection via mock-github.cjs, and loadCrossRefs() validation — all isolated in tmp directories via process.cwd() override. Also includes vitest infrastructure (vitest.config.js, test/setup.js, test/loadFixture.js, test/fixtures/github/) from PRs #247 and #260 required to run the test suite. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
snipcodeit
added a commit
that referenced
this pull request
Mar 6, 2026
…cycle (#250) (#261) Adds test/validate-and-load.test.js with 23 vitest integration tests (5 groups) covering fresh .mgw/ init, migrateProjectState() idempotency, loadActiveIssue() prefix pattern, staleness detection via mock-github.cjs, and loadCrossRefs() validation — all isolated in tmp directories via process.cwd() override. Also includes vitest infrastructure (vitest.config.js, test/setup.js, test/loadFixture.js, test/fixtures/github/) from PRs #247 and #260 required to run the test suite. Co-authored-by: Stephen Miller <Stephen@betterbox.pw> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
Closes #249
Configures vitest as the test runner for the v6 Local Testing & Simulation Framework (Phase 47: Mock Infrastructure). Adds test/setup.js for automatic mock activation, a loadFixture(name) helper, and vitest-based npm scripts.
Phase Context: Phase 47 of 4 in milestone v6 — Local Testing & Simulation Framework
GSD Route: plan-phase (quick-full execution)
Changes
package.jsonvitest ^2.0.0devDependency;npm test→vitest run; newtest:watchandtest:nodescriptsvitest.config.js.test.js, exclude.test.cjstest/setup.jstest/loadFixture.jsloadFixture(name)reads from test/fixtures/; namespaced paths supportedMock Compatibility
test/setup.jsuses conditionalrequire()withtry/catchfor bothlib/mock-github.cjs(PR #258) andlib/mock-gsd-agent.cjs(PR #259). The vitest infrastructure is fully functional before those PRs merge — tests run without errors and mocks auto-activate once the dependencies land.Script Compatibility
Existing node:test based
*.test.cjsfiles are preserved and accessible vianpm run test:node. The vitestincludepattern targets.test.jsand.spec.jsonly, with.test.cjsexplicitly excluded.Plan Summary (quick-10)
Task 1: Add vitest devDependency and update npm scripts in package.json
Task 2: Create vitest.config.js with setupFiles, node environment, include/exclude patterns
Task 3: Create test/setup.js with conditional mock activation (beforeEach/afterEach)
Task 4: Create test/loadFixture.js with loadFixture(name) helper and FIXTURES_DIR export
All 4 tasks completed in commit 0ef8314.
Test Plan
npm run test:node— existing node:test suite passes unchangednpm test— runs vitest (no vitest tests yet, exits 0 with "No test files found")npm run test:watch— vitest starts in watch modetest/setup.jsauto-activates both mocks in vitest testsloadFixture('github/issue-view')resolves totest/fixtures/github/issue-view.jsonloadFixture('agents/gsd-planner')resolves totest/fixtures/agents/gsd-planner.jsonloadFixture('nonexistent')throws descriptive errorDependencies
🤖 Generated with Claude Code