Skip to content

Commit 8f369e7

Browse files
robertsLandoclaude
andcommitted
test(unit): address Copilot review — drop unused infoed, clarify coverage docs
- test/unit/config-parse.test.ts: the `infoed` capture buffer was never asserted. Dropped it and silenced `log.info` directly so resolveTargetList/parseTargets fallback paths don't print during tests. - docs-site/development.md: `yarn coverage:e2e` uses `--clean=false` and therefore accumulates on top of whatever is in `coverage/tmp` — it is not "e2e-only" in general. Docs now state the actual behavior: fresh → e2e-only, after `yarn coverage:unit` → merged. No script change — the `--clean=false` design is intentional per #267 (unit + e2e accumulate via a single temp dir). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent aa1f7c5 commit 8f369e7

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

docs-site/development.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,17 @@ When running `node test/test.js all`, based on the options, each test will be ru
6565
`pkg` uses [c8](https://github.com/bcoe/c8) as a thin reporter over V8's built-in coverage. `NODE_V8_COVERAGE` propagates through child processes, so e2e coverage captures the `pkg` CLI executions spawned by the harness.
6666

6767
```bash
68-
yarn coverage:unit # unit-only coverage → coverage/lcov.info
69-
yarn coverage:e2e # e2e-only coverage (slow — full build matrix)
70-
yarn coverage # unit + e2e merged into a single report
68+
# Run unit coverage alone — always deterministic; clears coverage/tmp first.
69+
yarn coverage:unit
70+
71+
# Append e2e coverage on top of whatever is in coverage/tmp (uses `c8 --clean=false`).
72+
# After a fresh `yarn coverage:unit`, this produces a merged report. Without
73+
# a prior run it produces an e2e-only report. For a guaranteed e2e-only view,
74+
# delete `coverage/` first. (Slow — runs the full e2e matrix.)
75+
yarn coverage:e2e
76+
77+
# Full merged report: cleans, runs unit, then appends e2e, then emits lcov+text.
78+
yarn coverage
7179
```
7280

7381
### Example e2e test

test/unit/config-parse.test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ type LogFn = (..._a: unknown[]) => void;
2727
// validatePkgConfig calls log.warn; wasReported() (used elsewhere) calls
2828
// log.error before returning an Error. Capture the former for assertions,
2929
// silence the latter so assertion-triggered throws don't pollute output.
30+
// log.info is silenced too — some tests fire resolveTargetList/parseTargets
31+
// fallback paths that would otherwise print to stderr.
3032
let warned: string[];
31-
let infoed: string[];
3233
let originals: { warn: LogFn; info: LogFn; error: LogFn };
3334

3435
beforeEach(() => {
3536
warned = [];
36-
infoed = [];
3737
originals = {
3838
warn: log.warn as LogFn,
3939
info: log.info as LogFn,
@@ -42,9 +42,7 @@ beforeEach(() => {
4242
log.warn = ((...a: unknown[]) => {
4343
warned.push(a.join(' '));
4444
}) as typeof log.warn;
45-
log.info = ((...a: unknown[]) => {
46-
infoed.push(a.join(' '));
47-
}) as typeof log.info;
45+
log.info = (() => {}) as typeof log.info;
4846
log.error = (() => {}) as typeof log.error;
4947
});
5048

0 commit comments

Comments
 (0)