tsconfig.test.web.json

// DOM-flavoured half of the test typecheck (#337): the renderer, component and
// hook tests, plus the extension tests (extension/tsconfig.json is also a DOM
// project). Mirrors tsconfig.web.json's libs and adds the chrome typings the
// extension code needs.
//
// src/renderer/env.d.ts is listed explicitly: it declares window.birdbrain, and
// an ambient .d.ts nobody imports is otherwise absent from the program, which
// turns every bridge access in a renderer test into a phantom error.
//
// Claims every .tsx under tests/ wherever it sits, and every .tsx under a
// package's tests/ folder, so a component test added outside tests/components
// is still checked rather than falling through the gap between the two
// projects. The consequence to know: a .tsx placed under a
// node-flavoured directory (tests/main/, tests/shared/) lands here, and `paths`
// below declares no @main/* mapping — such a file importing @main/* fails to
// resolve. That is fail-closed but the message points at the import, not at the
// boundary. @main/* is deliberately absent: main-process code typechecked
// against the DOM lib is the false-positive case tsconfig.test.node.json's
// header describes.
//
// The six directory entries mirror tsconfig.test.node.json's exclude list and
// spell out each non-JSX extension tsc compiles (.ts/.mts/.cts, and so their
// .d.* forms); .ts alone would leave a stray .mts here in no project at all.
{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "composite": false,
    "noEmit": true,
    "lib": ["ES2022", "DOM", "DOM.Iterable"],
    "jsx": "react-jsx",
    "types": ["node", "chrome", "vitest/globals"],
    "paths": {
      "@renderer/*": ["./src/renderer/*"],
      "@shared/*": ["./src/shared/*"],
      "@extension/*": ["./extension/src/*"]
    }
  },
  "include": [
    "src/renderer/env.d.ts",
    "tests/**/*.tsx",
    "src/packages/**/tests/**/*.tsx",
    "tests/components/**/*.ts",
    "tests/components/**/*.mts",
    "tests/components/**/*.cts",
    "tests/extension/**/*.ts",
    "tests/extension/**/*.mts",
    "tests/extension/**/*.cts",
    "tests/hooks/**/*.ts",
    "tests/hooks/**/*.mts",
    "tests/hooks/**/*.cts",
    "tests/lib/**/*.ts",
    "tests/lib/**/*.mts",
    "tests/lib/**/*.cts",
    "tests/renderer/**/*.ts",
    "tests/renderer/**/*.mts",
    "tests/renderer/**/*.cts",
    "tests/setup/jsdom/**/*.ts",
    "tests/setup/jsdom/**/*.mts",
    "tests/setup/jsdom/**/*.cts"
  ]
}