2023-09-14 16:16:50 +02:00
|
|
|
import { defineConfig } from 'vitest/config';
|
|
|
|
|
2024-02-08 12:43:00 +01:00
|
|
|
/**
|
2024-08-15 10:26:24 +02: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.
|
|
|
|
*
|
2024-02-08 12:43:00 +01:00
|
|
|
* @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
|
|
|
},
|
|
|
|
});
|