Skip to content

build: TypeScript test files are never type-checked #899

Open

Description

@bpowers

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.ts imports JsonProjectPatch from '../json-types', a module that does not exist (type-only, so it is erased).
  • src/engine/tests/cleanup.test.ts builds a fake EngineBackend that lacks projectRenderPng.

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

Activity

  1. added
    ci
    hygiene
    on Oct 12, 2026
  2. changed the title [-]build: TypeScript test files are never type-checked (~55 latent type errors)[/-] [+]build: TypeScript test files are never type-checked[/+] on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cihygiene

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions