Skip to content

Commit 220467e

Browse files
qq9340100claude
andauthored
docs(devx): mark check-type-check-coverage.mjs's global-setup example historical (#8383)
`scripts/check-type-check-coverage.mjs` illustrates "widen a hidden test layer's include one file at a time" with `@objectstack/example-showcase`'s handling of `e2e/global-setup.ts`. PR #8178 (#8062) made both concrete claims stale: the package's tsconfig now takes the wholesale `e2e/**/*` glob directly (not the narrow `e2e/**/*.spec.ts` this file still described), and the 6 errors the narrow glob avoided are fixed at their source rather than excluded, so `global-setup.ts` is now read by the program and type-checks clean. Per the #8189 triage ruling (direction 2): keep the worked example, mark it historical at both sites (`:507` TEST_DEBT preamble, `:1705` `measureTestDebt()` docblock — the two are two halves of one worked example and move together), naming #8062 / PR #8178 as what changed. The general lesson survives unchanged: a wholesale glob can bill a hidden test layer for a non-test file it never asked to cover, so add hidden layers one file at a time and measure each. Prose-only change inside existing comments; zero behavior change. Fixes #8189 Claude-Session: https://claude.ai/code/session_01Jqe56GnYFddggeAyfkZFVz Co-authored-by: Claude <noreply@anthropic.com>
1 parent ebb14ec commit 220467e

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

scripts/check-type-check-coverage.mjs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,11 +502,19 @@ const EXEMPT = {
502502
// same one `packages/metadata-core` uses for the structurally identical hole.
503503
// - `@objectstack/example-showcase` took the widened-`include` route (#7312's
504504
// shape for app-crm / app-todo), because its `rootDir` is already `.` and
505-
// nothing needed neutralising. Its glob is `e2e/**/*.spec.ts` and NOT
505+
// nothing needed neutralising. Its glob was `e2e/**/*.spec.ts` and NOT
506506
// `e2e/**/*`, holding the same line the deleted entry's note drew: the
507507
// wholesale glob would pull in `e2e/global-setup.ts`, a fixture rather than a
508-
// test, and bill the test layer 6 errors that are not its own. That file is
509-
// still read by no tsc program and is filed rather than folded in here.
508+
// test, and bill the test layer 6 errors that are not its own.
509+
// (historical: until #8062 / PR #8178, that file sat read by no tsc program
510+
// at all. The package's own tsconfig now takes the wholesale `e2e/**/*`
511+
// glob directly, and the 6 errors are fixed at their source -- a file-local
512+
// `declare const process` plus `mkdirSync`/`writeFileSync` on the `node:fs`
513+
// shim in `examples/app-showcase/types/node-shim.d.ts` -- so
514+
// `global-setup.ts` is now read and type-checks clean. The lesson survives
515+
// the fix: widen a hidden test layer's `include` one file at a time and
516+
// measure each addition, because a wholesale glob can bill the layer for a
517+
// non-test file it never asked to cover.)
510518
// `@objectstack/cli` (188 raw across 56 files) is deliberately NOT part of that
511519
// graduation -- it is a programme rather than a sitting, and its entry stands.
512520
const TEST_DEBT = {
@@ -1705,6 +1713,13 @@ function defaultTypeRoots(pkgAbs, rootAbs) {
17051713
* directory glob -- `e2e/**\/*` would have pulled `e2e/global-setup.ts` into
17061714
* app-showcase's measurement and billed the test layer 6 errors from a file that
17071715
* is not a test.
1716+
* (historical: until #8062 / PR #8178, app-showcase held the narrow
1717+
* `e2e/**\/*.spec.ts` glob for exactly this reason. That card fixed the 6
1718+
* errors at their source instead and moved the package to the wholesale
1719+
* `e2e/**\/*` glob directly, so `global-setup.ts` is now in the program and
1720+
* type-checks clean. The general point stands regardless: widen a hidden test
1721+
* layer one file at a time and measure each addition, because a wholesale glob
1722+
* can bill the layer for a non-test file it never asked to cover.)
17081723
*
17091724
* `rootDir` goes with them. It is `src` in most of these packages, so widening
17101725
* `include` past it makes tsc answer with one TS6059 per added file and nothing

0 commit comments

Comments
 (0)