refactor(tests): extract makeMockExecaProcess helper in log-streamer.test.ts#3482
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors the log-streamer unit tests by extracting a small helper to build a minimal mocked execa child-process, reducing repeated mock setup and making future mock-shape changes easier to apply consistently.
Changes:
- Added
makeMockExecaProcess()helper to centralize creation of an emptyReadablestdout andkillmock. - Replaced three duplicated inline
mockStdout+mockProcessblocks with calls to the new helper. - Kept the first test’s bespoke
stdoutmock (which emits log data) unchanged.
Show a summary per file
| File | Description |
|---|---|
src/logs/log-streamer.test.ts |
Deduplicates repeated execa process mock construction via a new makeMockExecaProcess() helper. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
🔬 Smoke Test Results
PR: refactor(tests): extract makeMockExecaProcess helper in log-streamer.test.ts Overall: PARTIAL — GitHub MCP confirmed working; pre-computed smoke data was not expanded (template variables not substituted by runner).
|
🔥 Smoke Test: Copilot BYOK (Offline) Mode
Running in BYOK offline mode ( Author: Overall: PARTIAL PASS (BYOK inference and MCP confirmed ✅; pre-step data unavailable)
|
Smoke Test Results✅ GitHub API - 2 PR entries confirmed in recent-prs.json Status: PASS — All smoke tests passed.
|
|
Smoke Test: FAIL 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.
|
Chroot Version Comparison Results
Result: Not all tests passed — Python and Node.js versions differ between host and chroot environments.
|
|
Smoke test result: FAIL. Connectivity and MCP PR listing failed. File writing and bash tools passed. 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
|
Smoke Test: GitHub Actions Services Connectivity
Overall: FAIL — Service containers are unreachable.
|
A 10-line
mockStdout+mockProcessconstruction block was copy-pasted 3 times acrosssrc/logs/log-streamer.test.ts, meaning any change to the mock process shape (e.g. addingstderr) required edits in multiple places.Changes
src/logs/log-streamer.test.ts: Extracted amakeMockExecaProcesshelper that creates an emptyReadablestdout and ajest.fn()kill mock, replacing the 3 identical inline blocks:The first test's mock (which pushes actual log data to exercise output assertions) is left as-is since it has distinct behaviour.