test: integration tests for validate_and_load and state lifecycle#261
Merged
snipcodeit merged 1 commit intomainfrom Mar 6, 2026
Merged
Conversation
Owner
Author
Testing ProceduresPrerequisites
Running Tests# Run the new integration tests only
npx vitest run test/validate-and-load.test.js
# Run all vitest tests
npm run test
# Run in watch mode
npm run test:watch
# Run legacy node:test suite (not affected by this PR)
npm run test:nodeExpected OutputManual VerificationTo verify tmp directory isolation: # Run tests and confirm no .mgw/ was created in repo root
npx vitest run test/validate-and-load.test.js
ls .mgw/ # should still only contain existing state files, none from testsWhat Each Group Tests
|
This was referenced 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 <[email protected]>
0e28748 to
7d2521e
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.
Summary
test/validate-and-load.test.jswith 23 vitest integration tests across 5 groups covering the fullvalidate_and_loadpattern inlib/state.cjsprocess.cwd()override — no real.mgw/pollutionmigrateProjectState()idempotency verified with double-run assertionsmock-github.cjsinterceptingchild_process.execSyncCloses #250
Milestone Context
Changes
New Files
test/validate-and-load.test.js— 23 vitest integration tests (5 groups)test/fixtures/github/— 16 fixture JSON files formock-github.cjsactivationtest/setup.js— Vitest global setup with mock auto-activationtest/loadFixture.js— Fixture loader helpervitest.config.js— Vitest config targeting.test.js/.spec.jslib/mock-github.cjs— GitHub API interceptor for testsModified Files
package.json— Added vitest devDependency and test scripts (test,test:watch,test:node)Test Groups
Test Plan
vitest run test/validate-and-load.test.js— 23/23 tests pass.mgw/directories created outside tmp dirsprocess.cwd()restored inafterEachfor all describe blocksmigrateProjectState()called twice — state unchanged on second runmock-github.cjsinterceptschild_process.execSynccorrectlymock-github.cjsabsent (conditional require)test/fixtures/github/for mock activationGSD Progress