From 9ca35b8c02dd8867a6e9cb3283384d4db64d4098 Mon Sep 17 00:00:00 2001 From: adilallo <39313955+adilallo@users.noreply.github.com> Date: Sun, 14 Sep 2025 13:46:56 -0600 Subject: [PATCH] Batch tests --- .gitea/workflows/ci.yaml | 12 +++++++++--- vitest.config.mjs | 11 ++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 9ff6d10..41b325e 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -18,8 +18,8 @@ jobs: VITEST_MAX_CONCURRENCY: 1 VITEST_MAX_THREADS: 1 VITEST_MIN_THREADS: 1 - VITEST_POOL: "threads" - VITEST_POOL_OPTIONS: '{"threads":{"singleThread":true}}' + VITEST_POOL: "vmThreads" + VITEST_POOL_OPTIONS: '{"vmThreads":{"singleThread":true}}' VITEST_LOG_LEVEL: "info" DEBUG: "vitest:*" VITEST_WORKER_TIMEOUT: "300000" @@ -40,7 +40,13 @@ jobs: echo "CPU info: $(sysctl -n machdep.cpu.brand_string || uname -m)" - run: | echo "Running tests with CI optimizations..." - npm test -- --reporter=verbose --no-coverage --run + # Run tests in smaller batches to reduce memory pressure + echo "Running unit tests..." + npm test -- tests/unit/ --reporter=verbose --run --bail=1 + echo "Running integration tests..." + npm test -- tests/integration/ --reporter=verbose --run --bail=1 + echo "Running accessibility tests..." + npm test -- tests/accessibility/ --reporter=verbose --run --bail=1 # If the Codecov Action fails on Gitea, replace this with the bash uploader below - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 diff --git a/vitest.config.mjs b/vitest.config.mjs index d79a531..30e770e 100644 --- a/vitest.config.mjs +++ b/vitest.config.mjs @@ -41,8 +41,10 @@ export default defineConfig({ "**/build/**", ], thresholds: { lines: 50, functions: 50, statements: 50, branches: 50 }, + // Disable coverage collection in CI to prevent test failures + enabled: !process.env.CI, }, - pool: process.env.CI ? "forks" : "threads", // Use forks in CI for better stability + pool: process.env.CI ? "vmThreads" : "threads", // Use vmThreads in CI for better isolation testTimeout: process.env.CI ? 180000 : 30000, // 180s for CI, 30s for local hookTimeout: process.env.CI ? 180000 : 30000, // 180s for CI, 30s for local teardownTimeout: process.env.CI ? 180000 : 30000, // 180s for CI, 30s for local @@ -51,8 +53,15 @@ export default defineConfig({ maxThreads: process.env.CI ? 1 : 4, // Single thread in CI minThreads: process.env.CI ? 1 : 2, // Minimum threads in CI retry: process.env.CI ? 3 : 0, // More retries in CI + // Additional stability measures + isolate: process.env.CI ? true : false, // Better isolation in CI + passWithNoTests: true, // Don't fail if no tests found // Additional CI timeout settings workerTimeout: process.env.CI ? 300000 : 60000, // 5min for CI, 1min for local poolTimeout: process.env.CI ? 300000 : 60000, // 5min for CI, 1min for local + // Disable problematic features in CI + deps: { + inline: process.env.CI ? [] : undefined, // Don't inline dependencies in CI + }, }, });