feat: add lib/mock-github.cjs with GitHub API interceptors for tests#258
Merged
snipcodeit merged 3 commits intomainfrom Mar 6, 2026
Merged
Conversation
Implements the mock GitHub API layer for the v6 Local Testing & Simulation Framework milestone (Phase 47: Mock Infrastructure). - lib/mock-github.cjs: configurable execSync interceptor with fixture-based routing, scenario support, inline overrides, and call log - test/fixtures/github/: 16 fixture files covering issue CRUD, milestone CRUD, label operations, PR creation, and GraphQL board mutations All 64 existing github.test.cjs tests pass. No real gh CLI calls made when mock is active. Closes #247 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
1 task
snipcodeit
pushed a commit
that referenced
this pull request
Mar 6, 2026
Implements a fake GSD agent runner for offline MGW pipeline testing. The module intercepts Task() spawns, returns configurable fixture outputs, and records spawn calls for assertion. - lib/mock-gsd-agent.cjs: core mock module with activate/deactivate/ spawnStub/getCallLog/setResponse/isActive/getSpawnCount/assertSpawned API - test/fixtures/agents/: base fixture files for all 5 agent types (gsd-planner, gsd-executor, gsd-verifier, gsd-plan-checker, general-purpose) API mirrors lib/mock-github.cjs (PR #258) for consistency: - Same activate/deactivate/setResponse/getCallLog/isActive pattern - Scenario support: test/fixtures/agents/<scenario>/ overrides base fixtures - Inline overrides have highest precedence Closes #248 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This was referenced Mar 6, 2026
snipcodeit
pushed a commit
that referenced
this pull request
Mar 6, 2026
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 <[email protected]>
This was referenced Mar 6, 2026
snipcodeit
added a commit
that referenced
this pull request
Mar 6, 2026
Implements a fake GSD agent runner for offline MGW pipeline testing. The module intercepts Task() spawns, returns configurable fixture outputs, and records spawn calls for assertion. - lib/mock-gsd-agent.cjs: core mock module with activate/deactivate/ spawnStub/getCallLog/setResponse/isActive/getSpawnCount/assertSpawned API - test/fixtures/agents/: base fixture files for all 5 agent types (gsd-planner, gsd-executor, gsd-verifier, gsd-plan-checker, general-purpose) API mirrors lib/mock-github.cjs (PR #258) for consistency: - Same activate/deactivate/setResponse/getCallLog/isActive pattern - Scenario support: test/fixtures/agents/<scenario>/ overrides base fixtures - Inline overrides have highest precedence Closes #248 Co-authored-by: Stephen Miller <[email protected]> Co-authored-by: Claude Sonnet 4.6 <[email protected]>
snipcodeit
added a commit
that referenced
this pull request
Mar 6, 2026
…260) 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: Stephen Miller <[email protected]> Co-authored-by: Claude Sonnet 4.6 <[email protected]>
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
lib/mock-github.cjs— a configurableexecSyncinterceptor that routesghCLI commands to fixture-based responses during teststest/fixtures/github/with 16 JSON fixtures covering all five operation categories: issue CRUD, milestone CRUD, label operations, PR creation, and GraphQL board mutationssetResponse()overrides, and a call log for assertion in testsCloses #247
Milestone Context
Milestone: v6 — Local Testing & Simulation Framework
Phase: 47 — Mock Infrastructure
Position: 1 of 11 in milestone execution order
This is the foundational mock layer that downstream issues (#248–#255) depend on to write integration and scenario tests without real
ghCLI network calls.Changes
New files
lib/mock-github.cjstest/fixtures/github/issue-view.jsontest/fixtures/github/issue-list.jsontest/fixtures/github/issue-comment.jsontest/fixtures/github/issue-edit.jsontest/fixtures/github/milestone-view.jsontest/fixtures/github/milestone-create.jsontest/fixtures/github/milestone-close.jsontest/fixtures/github/label-create.jsontest/fixtures/github/label-list.jsontest/fixtures/github/pr-create.jsontest/fixtures/github/pr-view.jsontest/fixtures/github/rate-limit.jsontest/fixtures/github/board-item.jsontest/fixtures/github/graphql-board-mutation.jsontest/fixtures/github/repo-meta.jsontest/fixtures/github/discussion-create.jsonAPI
Test Plan
node verify-247.cjs)test/github.test.cjstests pass with 0 regressionsghCLI calls made when mock is activenode:testframework (no vitest dependency required)🤖 Generated with Claude Code