Files
waggle-os/vitest.config.ts
shumeiko.it 23431550ae build: one tsc -b build and a source export condition (P2.1)
- tsconfig.build.json references the nine in-scope packages; each package
  is composite and references the workspace packages it depends on.
  build:packages is now `tsc -b tsconfig.build.json` instead of a chain
  of cd commands.
- Every in-scope package exports its TypeScript entry under a `source`
  condition next to the dist/ entries. Vitest, tsx (dev:server, the
  Tauri dev launch, the e2e server), the sidecar and launcher bundles and
  the web app resolve it, so none of them needs build:packages first or
  can pick up a stale dist/. The vitest src aliases remain only for the
  excluded packages that have no source export.
- Published packages with a files list (agent, cli, marketplace) pack
  src/ too, so the source condition never points at a missing file.
- tsconfig.tests.json and `npm run typecheck:tests` type-check the test
  suites of the in-scope packages. They report 426 existing errors, so
  the CI step is advisory for now.
- The root test run leaves out the excluded and postponed packages
  (hive-mind-*, memory-mcp, wiki-compiler, team-server, waggle-dance,
  worker, weaver); they are not built either.
- CI runs the test job on Ubuntu, macOS and Windows with Node 22.23.2
  (ADR-0008), and no longer builds the hook runtime and the memory MCP
  server.
2026-10-24 17:14:29 +02:00

66 lines
2.5 KiB
TypeScript

import { defineConfig } from 'vitest/config';
import path from 'node:path';
import { INFRA_TEST_SUITES } from './vitest.infra-suites';
import { WAGGLE_SOURCE_CONDITIONS, waggleSrcAliases } from './vitest.aliases';
export default defineConfig({
resolve: {
// Workspace packages resolve to src/ through their `source` export, so
// tests need no build step (P2.1).
conditions: WAGGLE_SOURCE_CONDITIONS,
alias: {
// Packages without a `source` export (the excluded ones) map to src/.
...waggleSrcAliases(__dirname),
// App uses @/ alias for src directory
'@/': path.resolve(__dirname, 'app/src') + '/',
'@': path.resolve(__dirname, 'app/src'),
},
},
ssr: {
resolve: { conditions: WAGGLE_SOURCE_CONDITIONS },
},
test: {
globals: true,
// Passing tests should not bury failures under expected provider/startup
// diagnostics. Use `--silent=false` when investigating a failing case.
silent: true,
testTimeout: 30_000,
setupFiles: ['./vitest.setup.ts'],
pool: 'forks',
maxWorkers: 4,
include: [
'packages/*/tests/**/*.test.ts',
'packages/*/tests/**/*.test.tsx',
'packages/*/src/**/*.test.ts',
'tests/**/*.test.ts',
'scripts/**/*.test.ts',
'app/scripts/**/*.test.ts',
'app/tests/**/*.test.ts',
],
// INFRA_TEST_SUITES require live Postgres (5434) + Redis (6381); excluded
// from the default gate so `npm test` runs green without Docker. Run them
// via `npm run test:infra`.
exclude: [
'apps/**', 'node_modules/**', '**/__faza1-closed/**',
// Packages outside the community edition: excluded ones (ADR-0002) and
// the postponed team runtime (ADR-0003). They are not built either.
'packages/hive-mind-*/**', 'packages/memory-mcp/**', 'packages/wiki-compiler/**',
'packages/team-server/**', 'packages/waggle-dance/**', 'packages/worker/**',
'packages/weaver/**',
...INFRA_TEST_SUITES,
// Copies the ~13MB pre-built packages/marketplace/marketplace.db fixture
// (createTempDb). Proper fix: regenerate it from sources-seed.ts in test
// setup (P1.6).
'packages/marketplace/tests/sync-verification.test.ts',
// Wall-clock budgets run in a dedicated lane so filesystem/process
// contention cannot make the deterministic correctness gate flaky.
'packages/server/tests/performance/**',
],
coverage: {
provider: 'v8',
include: ['packages/*/src/**/*.ts'],
exclude: ['packages/*/src/**/*.d.ts'],
},
},
});