storybook/scripts/vitest.config.ts

24 lines
709 B
TypeScript
Raw Normal View History

2023-09-14 16:16:50 +02:00
import { defineConfig } from 'vitest/config';
2024-02-08 12:43:00 +01:00
/**
* CircleCI reports the wrong number of threads to Node.js, so we need to set it manually.
* Script tests are running with the small resource class, which has 1 vCPU.
* @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#L187
*/
const threadCount = process.env.CI ? 1 : undefined;
2023-09-14 18:31:06 +02:00
export default defineConfig({
test: {
clearMocks: true,
2024-02-08 12:43:00 +01:00
poolOptions: {
threads: {
minThreads: threadCount,
maxThreads: threadCount,
},
},
2023-09-14 18:31:06 +02:00
},
});