Repository navigation
Description
pnpm tsc does not type-check most TypeScript test files, so tests can import things that do not exist and build fixtures that no longer match the types.
Rstest compiles tests with swc, which strips types without checking them.
src/core, src/engine, src/diagram, and src/app exclude tests from their tsconfig.json, and @simlin/engine is not in the root tsc script at all.
src/server and src/simlin-serve/web are checked only because their include globs happen to cover the tests.
Example
On main, these compile without complaint because nothing looks:
src/diagram/tests/editor-applyPatch.test.tsimportsJsonProjectPatchfrom'../json-types', a module that does not exist (type-only, so it is erased).src/engine/tests/cleanup.test.tsbuilds a fakeEngineBackendthat lacksprojectRenderPng.
When this was measured (before #900 landed), a tests-only tsconfig reported 55 errors in 25 files, mostly fixtures missing fields of Aux/Stock/Flow/Module, wrong imports, and unused variables.
Why it matters
Test fixtures drift from the types they claim to build, and a mistyped mock still runs.
The two packages that are checked caught 9 mistyped rs.fn mocks during the Rstest migration; the others would have hidden them.
Fix
Fix the errors, then wire a check into the root tsc script so they stay fixed.
src/diagram and src/app already have a tsconfig.tests.json (used only by eslint); the simplest route is to add one to core and engine too and run tsc --noEmit -p tsconfig.tests.json in each package's check.
Alternative: one repo-root tsconfig.tests.json covering every package's tests (the original proposal; needs paths, module: esnext, @types/node, and the ambient CSS-module .d.ts files listed explicitly).
This also resolves #441 and supersedes tech-debt entry 57.
Pointers
- root
package.json(tscscript) src/{core,engine,diagram,app}/tsconfig.json(exclude),src/{diagram,app}/tsconfig.tests.json- core: test files are excluded from lint #441
Activity
tests: remove implementation-asserting tests repo-wide (#1012)
[-]build: TypeScript test files are never type-checked (~55 latent type errors)[/-][+]build: TypeScript test files are never type-checked[/+]