Skip to content

test: deduplicate main-action test setup and config fixtures - #11965

Merged
lpcox merged 3 commits into
mainfrom
copilot/fix-duplicate-code-main-action-tests
Nov 23, 2026
Merged

lpcox merged 3 commits into
mainfrom
copilot/fix-duplicate-code-main-action-tests

Conversation

@lpcox

@lpcox lpcox commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Main-action suites repeat mock initialization, platform setup, and inline sbx/enclave configurations.

  • Shared harness: Add describeMainAction() to centralize mock bindings, Linux/root setup, and per-test defaults for cleanup and workflow suites.
  • Config builders: Replace repeated fixtures with makeSbxConfig(overrides) and makeEnclaveConfig(executors), preserving scenario-specific options and using existing executor defaults.
makeSbxConfig({ containerWorkDir: '/workspace', enableApiProxy: true });
makeEnclaveConfig({ agent: { enabled: true, github: { cli: 'issues-read-v1' } } });

@lpcox lpcox changed the title [WIP] Fix duplicate code in main-action test harness and config fixtures Deduplicate main-action test setup and config fixtures Nov 22, 2026
@lpcox
lpcox marked this pull request as ready for review November 22, 2026 22:39
Copilot AI adaptive review requested due to automatic review settings November 22, 2026 22:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The shared Jest harness refactor changes hook ordering, mock identity, and reset behavior across multiple suites, so isolation and order-dependent failures require human verification with the affected tests.

No open issues 🎉

What changed in this PR

This PR centralizes duplicated main-action test setup and configuration fixtures into shared utilities, reducing repetition while preserving scenario-specific behavior.

Changes:

  • Added describeMainAction() for shared mocks, platform setup, and per-test defaults.
  • Added reusable makeSbxConfig() and makeEnclaveConfig() fixture builders.
  • Updated workflow, cleanup, coverage-gap, and harness tests to use the shared utilities.
File Description
src/​commands/​main-action.test-utils.ts Adds the shared main-action test harness and reusable SBX and enclave configuration builders.
src/​commands/​main-action-workflow.test.ts Migrates workflow tests to the shared harness and SBX configuration builder.
src/​commands/​main-action-harness.test.ts Tests fixture isolation, default values, shared mock identities, and harness reset behavior.
src/​commands/​main-action-coverage-gaps.test.ts Replaces repeated SBX configuration fixtures with the shared builder.
src/​commands/​main-action-cleanup.test.ts Migrates cleanup tests to the shared harness and enclave configuration builder.

Review effort: Lite (adaptive)

@github-actions

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@lpcox Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

@lpcox lpcox changed the title Deduplicate main-action test setup and config fixtures test: deduplicate main-action test setup and config fixtures Nov 22, 2026
@lpcox
lpcox merged commit 664fea3 into main Nov 23, 2026
46 of 47 checks passed
@lpcox
lpcox deleted the copilot/fix-duplicate-code-main-action-tests branch November 23, 2026 00:13
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.

[Duplicate Code] Main-action test harness and config fixtures duplicated across main-action-*.test.ts files

3 participants