Server-side simulation runtime: SimulationRunner owns one real WASM engine and its 20 Hz tick loop, applying commands (loadScenario, play/pause/reset, actuators, environment) and producing snapshots. attachRunnerToPort bridges it to a worker_thread port; the thread entrypoint lives in simulation-worker.entry.ts. Adds vitest to apps/api. Task: task_03. Tests: 12 passing (real engine + MessageChannel bridge), coverage 98.6% stmts / 89.5% branches. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
28 lines
742 B
TypeScript
28 lines
742 B
TypeScript
import { defineConfig } from 'vitest/config'
|
|
|
|
export default defineConfig({
|
|
test: {
|
|
include: ['src/**/*.test.ts'],
|
|
// Real WASM engine boots asynchronously and runs physics — allow headroom.
|
|
testTimeout: 30000,
|
|
hookTimeout: 30000,
|
|
coverage: {
|
|
provider: 'v8',
|
|
reporter: ['text', 'lcov'],
|
|
include: ['src/simulation/**/*.ts'],
|
|
exclude: [
|
|
'src/**/*.test.ts',
|
|
// Worker/thread entrypoints need a live worker_thread; the logic they
|
|
// wire is covered via MessageChannel unit tests.
|
|
'src/simulation/simulation-worker.entry.ts',
|
|
],
|
|
thresholds: {
|
|
lines: 80,
|
|
functions: 80,
|
|
branches: 80,
|
|
statements: 80,
|
|
},
|
|
},
|
|
},
|
|
})
|