Deduplicate main-action Jest harness setup across coverage-gap suites - #6691
Conversation
There was a problem hiding this comment.
Pull request overview
Centralizes duplicated filesystem mocks used by the main-action Jest suites.
Changes:
- Adds a shared filesystem mock factory and mock handles.
- Updates both main-action suites to consume the utility.
Show a summary per file
| File | Description |
|---|---|
src/commands/main-action-fs-mock.test-utils.ts |
Defines shared filesystem mocks. |
src/commands/main-action.test.ts |
Uses shared mocks and handles. |
src/commands/main-action-coverage-gaps.test.ts |
Uses the shared mock factory. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Medium
| import { mainActionFsMockFactory, mainActionFsMocks } from './main-action-fs-mock.test-utils'; | ||
|
|
||
| jest.mock('fs', () => mainActionFsMockFactory()); |
| closeSync: (...args: unknown[]) => mockCloseSync(...args), | ||
| }; | ||
| }); | ||
| jest.mock('fs', () => mainActionFsMockFactory()); |
|
@copilot address review feedback |
Fixed in the latest commit. Both |
|
✅ Copilot review passed with no inline comments. @copilot Add the |
|
| Metric | Base | PR | Delta |
|---|---|---|---|
| Lines | 99.17% | 99.19% | 📈 +0.02% |
| Statements | 99.07% | 99.09% | 📈 +0.02% |
| Functions | 99.45% | 99.35% | 📉 -0.10% |
| Branches | 95.75% | 95.75% | ➡️ +0.00% |
📁 Per-file Coverage Changes (1 files)
| File | Lines (Before → After) | Statements (Before → After) |
|---|---|---|
src/log-directory-setup.ts |
96.2% → 100.0% (+3.78%) | 96.3% → 100.0% (+3.71%) |
✨ New Files (1 files)
src/commands/main-action-fs-mock.test-utils.ts: 88.9% lines
Coverage comparison generated by scripts/ci/compare-coverage.ts
|
❌ Smoke Copilot BYOK AOAI (api-key) reports failed. AOAI BYOK (api-key) mode investigation needed... |
|
✅ Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓 |
|
🛡️ Smoke Copilot Network Isolation confirmed the egress allowlist is enforced. ✅ |
|
🔌 Smoke Services — All services reachable! ✅ |
|
✅ Smoke Claude passed |
|
✅ Contribution Check completed successfully! Contribution check complete for PR #6691: no actionable guideline violations found in the provided context. |
|
🚀 Security Guard has started processing this pull request |
|
✅ Build Test Suite completed successfully! |
|
✅ Smoke Gemini completed. All facets verified. 💎 |
|
📰 VERDICT: Smoke Docker Sbx has concluded. All systems operational. This is a developing story. 🎤 |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
Smoke Test: Claude Engine Validation
Overall result: PASS
|
|
📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅ |
🔒 Smoke Test: Copilot Network Isolation
Overall: PASS Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "example.com"See Network Configuration for more information.
|
🔥 Smoke Test: Copilot BYOK (Direct) — PASSRunning in direct BYOK mode (
Overall: PASS —
|
Smoke Test: GitHub Actions Services Connectivity
Overall: FAIL —
|
🔬 Smoke Test Results
Overall: PARTIAL — core HTTP connectivity passed; pre-computed smoke data unavailable (template variables not expanded at runtime).
|
Gemini Smoke Test Results
Overall Status: FAIL Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "localhost"See Network Configuration for more information.
|
Chroot Version Comparison Results
Result: FAILED — Node.js version mismatch (host
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
🔬 Smoke Test: API Proxy OpenTelemetry Tracing
Summary: All 5 scenarios pass. OTEL tracing integration is complete — span creation, token usage attributes (GenAI semantic conventions), parent context propagation, OTLP fan-out export, and graceful degradation via file fallback are all implemented and tested.
|
|
Reviewed PRs: Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "registry.npmjs.org"See Network Configuration for more information.
|
🧪 Smoke Test: Docker Sbx — PASS
Overall: PASS
|
Both
main-actiontest suites repeated the samefsmock boilerplate and harness-adjacent setup patterns, creating sync risk and unnecessary maintenance churn. This PR consolidates the duplicatedfsmock wiring into a shared test utility and updates both suites to consume it.What changed
src/commands/main-action-fs-mock.test-utils.tsto centralize sharedfsmock state and factory logic.jest.mock('fs', ...)blocks in:src/commands/main-action.test.tssrc/commands/main-action-coverage-gaps.test.tsmkdirSync,writeFileSync,chmodSync,openSync,closeSync) via shared exports.Why this refactor matters
Example