fix(test): count examples/* source in the coverage denominator - #749
Merged
sroussey merged 1 commit intoAug 13, 2026
Merged
Conversation
Collaborator
Author
|
This PR changes two files, both config ( Generated by Claude Code |
sroussey
force-pushed
the
claude/coverage-dist-bundle-fix-ew0vj8
branch
from
August 13, 2026 03:53
ced2825 to
97a0b75
Compare
`examples` is a first-class workspace group in both workspaceSource.ts and testDiscovery.ts, and all three example packages — @workglow/cli, @workglow/eval and @workglow/web — are published with none marked private. They carry 24 test files between them. The denominator listed only packages/* and providers/*, so their source was rewritten to src, executed by their own tests, and then left out of the measurement entirely: a coverage run from examples/cli reported `All files 0%` with no file rows at all. Pins coverage.root to the config's own directory rather than making the globs absolute. coverage.root is the documented base for include/exclude, and this config is invoked from package directories too (vitest run --config ../../vitest.config.ts), where a repo-relative glob would otherwise match nothing. It also does not depend on whether vitest accepts absolute glob patterns. Excludes examples/*/src/test/**: those dirs hold the example suites plus the occasional non-`.test.` helper the filename rules cannot catch, and counting a test helper is what the adjacent excludes already exist to prevent. Guards the invariant that broke, in workspaceSource.test.ts: every entry in WORKSPACE_GROUPS must be a prefix of some coverage.include glob, read from the actual config so the two cannot drift apart again. A missing group is invisible in a coverage report — it shows a shorter file list, not an error. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H797qbH356jjznKgUax63o
sroussey
force-pushed
the
claude/coverage-denominator-examples
branch
from
August 13, 2026 03:55
30bc818 to
b1bc569
Compare
sroussey
merged commit Aug 13, 2026
4bce057
into
claude/coverage-dist-bundle-fix-ew0vj8
10 of 11 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on #741 (retarget to
mainonce that merges). Rebased ontoorigin/main(67bed681). Independent of #748 — deliberately separate, since adding a CI job and changing the denominator in one PR makes the coverage delta unreadable.What
examplesis a first-class workspace group in bothscripts/lib/workspaceSource.ts(WORKSPACE_GROUPS) andscripts/lib/testDiscovery.ts. All three example packages are published and none isprivate—@workglow/cli,@workglow/eval,@workglow/web, all at 0.3.38 — and they carry 24 test files between them (7 / 14 / 3).coverage.includelisted onlypackages/*/srcandproviders/*/src. So example source was rewritten tosrcby the resolver, executed by its own tests, and then omitted from the measurement. Demonstrated:Not merely a wrong number: 28 passing tests were contributing coverage to nothing at all.
Why this fix
includegainsexamples/*/src/**/*.{ts,tsx}, and the adjacent comment now names all three groups so the next reader cannot infer the omission was intentional.coverage.root: __dirnamerather than making the globs absolute.coverage.rootis the documented base forinclude/exclude, and this config is invoked from package directories too (vitest run --config ../../vitest.config.ts --project cli), where a repo-relative glob would otherwise match nothing. It also sidesteps the question of whether vitest 4 accepts absolute glob patterns, which could not be settled here. From the repo root it is a no-op, since root and__dirnamecoincide.examples/*/src/test/**added toexclude. Found while verifying: the examples keep their suites insrc/test, which also holdsexamples/cli/src/test/chromeAvailability.ts— a test helper with no.test.in its name, so the existing filename rules miss it. It showed up assrc/test | 18.75%. Counting testing-only helpers is exactly what the neighbouringpackages/test/**and**/testing/**entries exist to prevent.Tests
scripts/workspaceSource.test.tsgains the invariant that actually broke: every entry inWORKSPACE_GROUPSmust be the prefix of somecoverage.includeglob. It reads the realvitest.config.ts(the idiomtestDiscovery.test.tsalready uses for project roots) rather than re-deriving it, so the resolver and the denominator cannot drift apart again.A missing group is otherwise invisible: a coverage report shows a shorter file list, never an error — which is how this survived in the first place.
Actually executed:
vitest --project scripts: 3 files, 15 passed.vitest.config.tsreverted: 1 failed / 14 passed,AssertionError: expected [ 'examples' ] to deeply equal []— it names the missing group.examples/clibefore and after (output above).packages/*rows still present, socoverage.rootdid not disturb the existing globs.prettier --checkclean.Not executed: a full
bun run test:vitest:unit --coverageover all 518 files. Too slow here; the narrow runs above exercise both invocation styles.Risk / blast radius
The reported total will move, and probably down — three packages' source joins the denominator at whatever their real coverage is (
~24%forcli). That is a corrected measurement, not a regression, but a reviewer watching a coverage gate must expect the step change. This is why it is not bundled with #748.Config-only otherwise. No product code, no test behaviour, nothing shipped to consumers.
Unverified
coverage.includewas not observed directly;coverage.rootwas chosen because it is the documented base and does not depend on that answer. Both invocation styles were checked empirically instead.buildfailure inherited frommain(see the note at the top).