Skip to content

Commit 5e8aeb6

Browse files
committed
test(e2e): add missing vitest.e2e.config.mts
Create Vitest configuration for end-to-end tests to fix CI e2e-tests workflow. Configuration: - Includes only **/*.e2e.test.{mts,ts} files - Uses 60s timeout for process spawning tests - Full thread isolation for clean execution - Same alias resolution as unit tests Fixes: "Could not resolve vitest.e2e.config.mts" error in CI
1 parent 4b57069 commit 5e8aeb6

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

packages/cli/vitest.e2e.config.mts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import os from 'node:os'
2+
import path from 'node:path'
3+
import { fileURLToPath } from 'node:url'
4+
5+
import { defineConfig } from 'vitest/config'
6+
7+
import { getLocalPackageAliases } from './scripts/utils/get-local-package-aliases.mjs'
8+
9+
// Get the socket-cli repo root directory.
10+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
11+
const repoRoot = path.resolve(__dirname, '../..')
12+
13+
export default defineConfig({
14+
resolve: {
15+
alias: getLocalPackageAliases(repoRoot),
16+
preserveSymlinks: false,
17+
},
18+
test: {
19+
globals: false,
20+
environment: 'node',
21+
include: [
22+
'**/*.e2e.test.{mts,ts}',
23+
],
24+
exclude: [
25+
'**/node_modules/**',
26+
'**/dist/**',
27+
'**/.{idea,git,cache,output,temp}/**',
28+
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*',
29+
],
30+
reporters: ['default'],
31+
setupFiles: ['./test/setup.mts'],
32+
// Use threads for better performance.
33+
pool: 'threads',
34+
poolOptions: {
35+
threads: {
36+
singleThread: false,
37+
maxThreads: os.cpus().length,
38+
minThreads: Math.min(4, os.cpus().length),
39+
// E2E tests need full isolation for clean execution.
40+
isolate: true,
41+
},
42+
},
43+
// E2E tests need longer timeouts for spawning processes.
44+
testTimeout: 60_000,
45+
hookTimeout: 60_000,
46+
},
47+
})

0 commit comments

Comments
 (0)