|
| 1 | +// The TEST-layer type-check program (#5476, the mechanism #5286/PR #5478 set for |
| 2 | +// `packages/spec` and PR #5546 carried to `packages/client`). `tsconfig.json` |
| 3 | +// beside this one stays as it is: it is the BUILD config, and `package.json`'s |
| 4 | +// `typecheck` script NAMES this sibling (`tsc --noEmit -p tsconfig.test.json`), |
| 5 | +// because a config no script invokes is exactly the phantom this change is about. |
| 6 | +// |
| 7 | +// THIS PACKAGE'S HOLE WAS A DIFFERENT SHAPE from spec's and client's, and that |
| 8 | +// is what dictates the two options below. Neither of those two configs excluded |
| 9 | +// `test/**` — they excluded `**/*.test.ts`, so the repair was to put an excluded |
| 10 | +// region back. Here nothing was excluded at all: `include` is `["src/**/*"]` and |
| 11 | +// the six files under `test/` simply live outside that root, so no `exclude` |
| 12 | +// entry names them and TESTS_COVERED (which counts only under the include roots) |
| 13 | +// never saw them either — this package's testFiles count was 0. The two test |
| 14 | +// files that live under `src/` (`protocol-handshake.test.ts`, |
| 15 | +// `objects/sys-view-definition.object.test.ts`) were compiled all along; the |
| 16 | +// sibling `test/` tree was not. |
| 17 | +// |
| 18 | +// What differs from the build config, and what deliberately does NOT: |
| 19 | +// - `rootDir` widens from `src` to the package root. It steers emit layout |
| 20 | +// only, and this program emits nothing (`noEmit`), but inherited as `src` it |
| 21 | +// reports TS6059 ("not under rootDir") for all six `test/**` files — the |
| 22 | +// check being misconfigured, not the tests being wrong. Widening it in the |
| 23 | +// BUILD config instead is not an option: `tsc` there emits (`dev`: |
| 24 | +// `tsc --watch`, `outDir: dist`), so a package-root `rootDir` would relocate |
| 25 | +// `dist/index.js` to `dist/src/index.js` — breaking `main`/`exports` — and |
| 26 | +// start writing `dist/test/**/*.test.js`, which ci.yml gates against ("No |
| 27 | +// compiled test files in any dist"). Emit constraints belong to the build |
| 28 | +// config; this one has none. |
| 29 | +// - MODULE SEMANTICS ARE UNTOUCHED, unlike spec's and client's siblings. Those |
| 30 | +// packages have no `"type": "module"`, so the build config's NodeNext |
| 31 | +// compiled their ESM tests as CJS and reported errors about the CHECK |
| 32 | +// (TS2835, TS1470, TS2550); switching to `esnext`/`bundler` was fidelity to |
| 33 | +// how vitest executes them. `@objectstack/metadata-core` IS `"type": |
| 34 | +// "module"`, so NodeNext already reads these files as ESM — and it is the |
| 35 | +// STRICTER of the two, since it holds the `.js` import extensions this |
| 36 | +// package must ship (`bundler` resolution would let a missing extension |
| 37 | +// compile here and fail at runtime under Node). Nothing to fix, so nothing |
| 38 | +// is changed. |
| 39 | +// - STRICTNESS IS UNTOUCHED. `strict`, `noUnusedLocals`, `noUnusedParameters`, |
| 40 | +// `noImplicitReturns` and the rest are inherited from the root config. |
| 41 | +// Nothing here may loosen a type rule; if a test does not compile, that is |
| 42 | +// the finding. |
| 43 | +// |
| 44 | +// There is NO `test-typecheck-debt.json` beside this config, on purpose. The |
| 45 | +// whole test layer compiles at ZERO errors under it, so the per-file EXACT |
| 46 | +// shrink-only ledger (`scripts/check-test-typecheck.mts`, which spec and client |
| 47 | +// wire because they carry 691 and 6 residual errors) would hold nothing while |
| 48 | +// costing this package a `tsx` dependency and two more scripts. A bare |
| 49 | +// `tsc --noEmit -p tsconfig.test.json` is the strictly stronger gate at zero |
| 50 | +// residue: ANY error here is red immediately, with no ledger to be added to. |
| 51 | +// If this package ever acquires residue that cannot be fixed in its own PR, |
| 52 | +// that is the moment to wire the shared script — not before. |
| 53 | +{ |
| 54 | + "extends": "./tsconfig.json", |
| 55 | + "compilerOptions": { |
| 56 | + "noEmit": true, |
| 57 | + "rootDir": "." |
| 58 | + }, |
| 59 | + "include": ["src/**/*", "test/**/*"], |
| 60 | + "exclude": ["node_modules", "dist"] |
| 61 | +} |
0 commit comments