chore: tune vitest parallelism
This commit is contained in:
@@ -1,9 +1,12 @@
|
|||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
import os from "node:os";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
import { defineConfig } from "vitest/config";
|
import { defineConfig } from "vitest/config";
|
||||||
|
|
||||||
const repoRoot = path.dirname(fileURLToPath(import.meta.url));
|
const repoRoot = path.dirname(fileURLToPath(import.meta.url));
|
||||||
const isCI = process.env.CI === "true" || process.env.GITHUB_ACTIONS === "true";
|
const isCI = process.env.CI === "true" || process.env.GITHUB_ACTIONS === "true";
|
||||||
|
const cpuCount = os.cpus().length;
|
||||||
|
const localWorkers = Math.min(16, Math.max(4, Math.floor(cpuCount * 0.5)));
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
resolve: {
|
resolve: {
|
||||||
@@ -15,7 +18,7 @@ export default defineConfig({
|
|||||||
testTimeout: 60_000,
|
testTimeout: 60_000,
|
||||||
hookTimeout: 120_000,
|
hookTimeout: 120_000,
|
||||||
pool: "forks",
|
pool: "forks",
|
||||||
maxWorkers: isCI ? 3 : 4,
|
maxWorkers: isCI ? 3 : localWorkers,
|
||||||
include: [
|
include: [
|
||||||
"src/**/*.test.ts",
|
"src/**/*.test.ts",
|
||||||
"extensions/**/*.test.ts",
|
"extensions/**/*.test.ts",
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
|
import os from "node:os";
|
||||||
import { defineConfig } from "vitest/config";
|
import { defineConfig } from "vitest/config";
|
||||||
|
|
||||||
|
const isCI = process.env.CI === "true" || process.env.GITHUB_ACTIONS === "true";
|
||||||
|
const cpuCount = os.cpus().length;
|
||||||
|
const e2eWorkers = isCI ? 2 : Math.min(4, Math.max(1, Math.floor(cpuCount * 0.25)));
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
test: {
|
test: {
|
||||||
|
pool: "forks",
|
||||||
|
maxWorkers: e2eWorkers,
|
||||||
include: ["test/**/*.e2e.test.ts"],
|
include: ["test/**/*.e2e.test.ts"],
|
||||||
setupFiles: ["test/setup.ts"],
|
setupFiles: ["test/setup.ts"],
|
||||||
exclude: [
|
exclude: [
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import { defineConfig } from "vitest/config";
|
|||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
test: {
|
test: {
|
||||||
|
pool: "forks",
|
||||||
|
maxWorkers: 1,
|
||||||
include: ["src/**/*.live.test.ts"],
|
include: ["src/**/*.live.test.ts"],
|
||||||
setupFiles: ["test/setup.ts"],
|
setupFiles: ["test/setup.ts"],
|
||||||
exclude: [
|
exclude: [
|
||||||
|
|||||||
Reference in New Issue
Block a user