[Test Coverage] coverage-gaps.test.ts - #5941
Conversation
… import branch - config-file.ts: exercise readStdinSync (the real default readStdin fn) via mocked fs.readFileSync, bringing function coverage from 66% to 100% - pid-tracker.ts: call trackPidForPortSync() and isPidTrackingAvailable() without the optional procPath argument to cover default-parameter branches, improving branch coverage from 80.76% to 84.61% - cli.ts: verify module imports cleanly when not the main entry point, exercising the require.main !== module branch path Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a focused Jest test file to cover a handful of previously-uncovered branches/functions in core modules (config loading, PID tracking defaults, and CLI entrypoint import behavior), improving overall coverage without invoking privileged operations.
Changes:
- Adds tests covering
loadAwfFileConfig('-')using the defaultreadStdinSyncpath. - Adds tests that exercise
pid-trackerdefault parameter branches (procPath = '/proc') via the public APIs. - Adds a test that imports
cli.tsto hit therequire.main !== modulebranch.
Show a summary per file
| File | Description |
|---|---|
src/coverage-gaps.test.ts |
New unit tests targeting specific coverage gaps in config-file.ts, pid-tracker.ts, and cli.ts. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Low
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
✅ Contribution Check completed successfully! PR #5941 follows the applicable CONTRIBUTING.md guidelines based on the provided metadata, diff, and contribution guide; no comment needed. |
|
🔌 Smoke Services — All services reachable! ✅ |
|
📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅ |
|
Chroot tests failed Smoke Chroot failed - See logs for details. |
|
❌ Smoke Copilot BYOK AOAI (Entra) reports failed. AOAI BYOK (Entra) mode investigation needed... |
|
❌ Smoke Copilot BYOK AOAI (api-key) reports failed. AOAI BYOK (api-key) mode investigation needed... |
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
|
🔑 Smoke Copilot PAT PAT auth validated. All systems operational. ✅ |
|
🚀 Security Guard has started processing this pull request |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 No GitHub write action was needed yet; I am still collecting the required smoke-test inputs. |
|
✅ Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓 |
|
✅ Build Test Suite completed successfully! |
|
✅ Smoke Claude passed |
|
✅ Smoke Gemini completed. All facets verified. 💎 |
Smoke Test: Claude Engine Validation
Overall Result: PASS Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
Smoke Test: Services Connectivity
Overall: FAIL — Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
Smoke Test: Copilot PAT Auth PASS
Overall: PASS | Auth mode: PAT (COPILOT_GITHUB_TOKEN) Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
🤖 Smoke Test Results
Overall: PASS Author: Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
Smoke Test: Copilot BYOK (Direct) Mode
Mode: Direct BYOK (COPILOT_PROVIDER_API_KEY) via api-proxy → api.githubcopilot.com Overall: PASS — Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
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.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
Smoke Test: API Proxy OpenTelemetry Tracing
All scenarios pass. The OTEL tracing integration is fully implemented with a complete test suite (59 tests, 0 failures). Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
|
[Test Coverage] coverage-gaps.test.ts | ✅ merged PR review | ✅ PR query | ✅ playwright title | ✅ file write | ✅ discussion query | ❌ npm ci && npm run build | FAIL Warning Firewall blocked 2 domainsThe following domains were blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"
- "registry.npmjs.org"See Network Configuration for more information.
|
Summary
Adds
src/coverage-gaps.test.tstargeting three specific uncovered code paths identified in the coverage report.Coverage improvements
src/config-file.tssrc/pid-tracker.tssrc/cli.tsWhat each test covers
config-file.ts—readStdinSync(defaultreadStdinparameter)The real
readStdinSyncfunction (fs.readFileSync(process.stdin.fd, 'utf8')) was never exercised because all existing tests inject a customreadStdinoverride. New tests callloadAwfFileConfig('-')without the override, withfs.readFileSyncmocked, so Istanbul records the function as covered.pid-tracker.ts— defaultprocPath = '/proc'branchesAll existing tests supply
mockProcPathexplicitly. Istanbul marks the default-parameter branch as uncovered. New tests callisPidTrackingAvailable()andtrackPidForPortSync(1)without any argument, exercising the'/proc'default branch. Tests handle non-Linux CI gracefully.cli.ts—require.main !== modulebranchVerifies the module can be cleanly imported without
program.parse()being called — exercises the false-branch of therequire.main === moduleguard.Test isolation
fs.readFileSyncmocked only within the describe block that needs itWarning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
awmgmcpgSee Network Configuration for more information.