-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtsconfig.test.json
More file actions
47 lines (47 loc) · 2.71 KB
/
Copy pathtsconfig.test.json
File metadata and controls
47 lines (47 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// The TEST-layer type-check program (#5286). `tsconfig.json` above stays as it
// is: it is the BUILD config, and its `**/*.test.ts` exclusion has a reason —
// ci.yml gates that no test file reaches the published artifact. This sibling
// puts the excluded layer back in front of tsc, and `package.json`'s
// `typecheck` script names it (`check:test-typecheck --project`), because a
// config no script invokes is exactly the phantom this whole change is about.
//
// What differs from the build config, and what deliberately does NOT:
// - module semantics ONLY. The tests are written and executed as ESM by
// vitest (esbuild/vite), while `spec` has no `"type": "module"`, so the
// build config's NodeNext compiles them as CJS and reports 108 errors about
// the CHECK rather than the code (TS2835 dynamic-import extensions, TS1470
// `import.meta`, TS2307, TS2550). Matching vitest is fidelity.
// - STRICTNESS IS UNTOUCHED. `strict`, `noUnusedLocals`, `noImplicitReturns`
// and the rest are inherited from the root config. Nothing about this file
// may loosen a type rule; if a test does not compile, that is the finding.
// - `rootDir` widens to the PACKAGE, from the build config's `./src` (#4796).
// Under `noEmit` that setting carries no output meaning; all it does is
// constrain which files may enter the program, and this program genuinely
// spans both directories — `vitest.config.ts` runs `src/**/*.test.ts` AND
// `scripts/**/*.test.ts` as one suite, and a `src` test importing a
// `scripts/lib` helper was a TS6059 purely because the emitting config's
// root had been inherited into a non-emitting one. This is not a
// strictness change: nothing stops being checked, and `include` still
// stops at `src` so no scripts file is pulled in unless a test imports it.
//
// `include` deliberately stops at `src`, matching the build config's root.
// `scripts/` — which vitest also runs, and which holds every generator and gate
// script — is the sibling `tsconfig.scripts.json` (#5475). It stayed a separate
// program rather than a wider `include` here for two measured reasons: it needs
// `allowImportingTsExtensions`, which would buy `src` nothing and would let a
// `src/**/*.test.ts` import `./x.ts` in a spelling the emitting build config
// still rejects; and it carries no ledger entries at all, so plain `tsc` is a
// stricter gate for it than this file's shrink-only debt list.
{
"extends": "./tsconfig.json",
"compilerOptions": {
"noEmit": true,
"rootDir": ".",
"module": "esnext",
"moduleResolution": "bundler",
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"types": ["node"]
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}