Repository navigation
Consolidate main-action Jest mock and harness boilerplate - #11848
Merged
Merged
Conversation
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
lpcox
marked this pull request as ready for review
November 19, 2026 22:56
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Runtime validation is needed to confirm Jest module-loading order, hoisted mock registration, and nested lifecycle-hook cleanup preserve isolation across all affected suites.
No open issues 🎉
What changed in this PR
This PR consolidates duplicated Jest setup across the main-action test suites while preserving specialized enclave and coverage-gap mocking behavior.
Changes:
- Centralizes common and enclave-specific mock registration.
- Adds typed
getMainActionMocks()access and default harness dependency wiring. - Adds reusable platform and process lifecycle harness setup with focused tests.
| File | Description |
|---|---|
| src/commands/main-action.test-utils.ts | Provides typed mock access, default harness dependencies, and platform lifecycle setup. |
| src/commands/main-action-workflow.test.ts | Replaces duplicated setup with shared mocks and platform lifecycle handling. |
| src/commands/main-action-mocks.test-utils.ts | Registers common main-action module mocks. |
| src/commands/main-action-harness.test.ts | Tests shared mock identity, default wiring, and platform harness behavior. |
| src/commands/main-action-enclave-mocks.test-utils.ts | Adds opt-in enclave-related mocks on top of the common mocks. |
| src/commands/main-action-coverage-gaps.test.ts | Uses common mocks while retaining the suite's smaller mock set. |
| src/commands/main-action-config-artifacts.test.ts | Replaces duplicated setup with shared mocks and platform lifecycle handling. |
| src/commands/main-action-cleanup.test.ts | Replaces duplicated setup with shared mocks and platform lifecycle handling. |
| src/commands/main-action-argument-parsing.test.ts | Uses the shared mocks and platform harness for argument-parsing tests. |
Review effort: Lite (adaptive)
Contributor
|
✅ Copilot review passed with no inline comments. @lpcox Add the |
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.
Five main-action suites duplicate module mock registration, typed mock declarations, and platform/exit setup.
getMainActionMocks()and default dependency wiring for the existing harness.setupMainActionPlatformHarness()to manage Linux/root setup and restore platform state and spies.