-
Notifications
You must be signed in to change notification settings - Fork 8
/
vitest.workspace.ts
31 lines (28 loc) · 997 Bytes
/
vitest.workspace.ts
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
import { resolve } from 'node:path'
import { defineConfig, defineWorkspace } from 'vitest/config'
export default defineWorkspace(['packages/*/vitest.config.ts'])
/**
* CircleCI reports the wrong number of threads to Node.js, so we need to set it manually.
* Unit tests are running with the xlarge resource class, which has 8 vCPUs.
* @see https://jahed.dev/2022/11/20/fixing-node-js-multi-threading-on-circleci/
* @see https://vitest.dev/config/#pooloptions-threads-maxthreads
* @see https://circleci.com/docs/configuration-reference/#x86
* @see .circleci/config.yml#L214
*/
const threadCount = process.env.CI ? 8 : undefined
export const vitestCommonConfig = defineConfig({
test: {
passWithNoTests: true,
clearMocks: true,
setupFiles: [resolve(__dirname, './vitest-setup.ts')],
globals: true,
testTimeout: 10000,
environment: 'node',
poolOptions: {
threads: {
minThreads: threadCount,
maxThreads: threadCount,
},
},
},
})