-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvitest.config.ts
More file actions
83 lines (81 loc) · 2.46 KB
/
vitest.config.ts
File metadata and controls
83 lines (81 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import { defineConfig } from "vitest/config"
import { fileURLToPath } from "node:url"
import { dirname, resolve } from "node:path"
const EFFECT_INFO_LOG_RE = /^timestamp=\d{4}-\d{2}-\d{2}T.* level=INFO fiber=#\d+ message=/
const ROOT_DIR = dirname(fileURLToPath(import.meta.url))
// Run with: bunx --bun vitest run
// The --bun flag ensures bun is the runtime so bun:sqlite is available in forked workers.
export default defineConfig({
resolve: {
conditions: ["bun"],
alias: [
{
find: /^@jamesaphoenix\/tx-core\/services$/,
replacement: resolve(ROOT_DIR, "packages/core/src/services/index.ts"),
},
{
find: /^@jamesaphoenix\/tx-core$/,
replacement: resolve(ROOT_DIR, "packages/core/src/index.ts"),
},
{
find: /^@jamesaphoenix\/tx-test-utils$/,
replacement: resolve(ROOT_DIR, "packages/test-utils/src/index.ts"),
},
{
find: /^@jamesaphoenix\/tx-types$/,
replacement: resolve(ROOT_DIR, "packages/types/src/index.ts"),
},
{
find: /^@jamesaphoenix\/tx$/,
replacement: resolve(ROOT_DIR, "packages/tx/src/index.ts"),
},
],
},
ssr: {
external: ["bun:sqlite"],
noExternal: [],
},
test: {
include: [
"test/**/*.test.ts",
"eslint-plugin-tx/tests/**/*.test.js"
],
exclude: [
// Commands not yet registered in CLI — tests exist ahead of implementation
"test/integration/daemon-cli.test.ts",
"test/integration/cli-graph.test.ts",
"test/integration/cli-test-cache.test.ts",
// npm binary distribution test: slow (npm pack + install), run explicitly
"test/integration/cli-npm-binary.test.ts",
// install script test: requires network access to GitHub
"test/integration/install-script.test.ts",
// utils usage tests: require real CLIs + network (run explicitly)
"test/integration/utils-usage.test.ts",
],
setupFiles: ["./vitest.setup.ts"],
environment: "node",
testTimeout: 10000,
teardownTimeout: 10000,
hookTimeout: 60000,
pool: "forks",
// Vitest 4: poolOptions moved to top-level
maxWorkers: 4,
isolate: true,
sequence: {
concurrent: false
},
onConsoleLog(log, type) {
if (
type === "stdout" &&
(EFFECT_INFO_LOG_RE.test(log) || log.startsWith("runWorker: Worker "))
) {
return false
}
},
server: {
deps: {
external: ["bun:sqlite"],
}
}
}
})