2026-08-13 15:30:54 +03:00
|
|
|
import path from 'node:path';
|
2026-06-27 09:45:34 +03:00
|
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
|
import { defineConfig } from 'vitest/config';
|
|
|
|
|
|
2026-08-13 15:30:54 +03:00
|
|
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
|
|
|
|
2026-06-27 09:45:34 +03:00
|
|
|
export default defineConfig({
|
|
|
|
|
resolve: {
|
2026-08-13 15:30:54 +03:00
|
|
|
alias: [
|
|
|
|
|
{ find: 'bun:test', replacement: path.resolve(here, './test/bun-test-shim.ts') },
|
|
|
|
|
// The same shared-UI aliases the app build uses. Without them a test can
|
|
|
|
|
// reference `@openchamber/ui/...` in a mock factory but not resolve the
|
|
|
|
|
// real module behind it, which is what forced mocks to hand-copy export
|
|
|
|
|
// lists that then fell behind the source.
|
|
|
|
|
{ find: '@opencode-ai/sdk/v2', replacement: path.resolve(here, '../../node_modules/@opencode-ai/sdk/dist/v2/client.js') },
|
|
|
|
|
{ find: '@openchamber/ui', replacement: path.resolve(here, '../ui/src') },
|
|
|
|
|
{ find: '@web', replacement: path.resolve(here, './src') },
|
|
|
|
|
// Anchored to `@/` on purpose: a bare `@` prefix would also swallow
|
|
|
|
|
// scoped dependencies the server tests rely on, such as `@octokit/rest`.
|
|
|
|
|
{ find: /^@\//, replacement: `${path.resolve(here, '../ui/src')}/` },
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
test: {
|
|
|
|
|
// The Git suites drive a real `git` binary against temporary repositories.
|
|
|
|
|
// Those subprocess round-trips routinely pass the 5s default, and which
|
|
|
|
|
// cases exceed it shifts with machine load, so the default made a valid
|
|
|
|
|
// suite fail differently on every run.
|
|
|
|
|
testTimeout: 30_000,
|
|
|
|
|
hookTimeout: 30_000,
|
2026-06-27 09:45:34 +03:00
|
|
|
},
|
|
|
|
|
});
|