From 2550eaa9b977b07748bb29cc5dd2f6eae544c3d7 Mon Sep 17 00:00:00 2001 From: adilallo <39313955+adilallo@users.noreply.github.com> Date: Sun, 14 Sep 2025 13:55:03 -0600 Subject: [PATCH] Try splitting up unit and integration tests --- .gitea/workflows/ci.yaml | 8 ++++---- vitest.config.mjs | 32 ++++++++++++++++---------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 41b325e..b83a5e2 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -40,13 +40,13 @@ jobs: echo "CPU info: $(sysctl -n machdep.cpu.brand_string || uname -m)" - run: | echo "Running tests with CI optimizations..." - # Run tests in smaller batches to reduce memory pressure + # Run tests in smaller batches to avoid resource contention echo "Running unit tests..." - npm test -- tests/unit/ --reporter=verbose --run --bail=1 + npm test -- tests/unit/ --run --reporter=verbose --no-coverage --maxConcurrency=1 echo "Running integration tests..." - npm test -- tests/integration/ --reporter=verbose --run --bail=1 + npm test -- tests/integration/ --run --reporter=verbose --no-coverage --maxConcurrency=1 echo "Running accessibility tests..." - npm test -- tests/accessibility/ --reporter=verbose --run --bail=1 + npm test -- tests/accessibility/ --run --reporter=verbose --no-coverage --maxConcurrency=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 30e770e..7f05f20 100644 --- a/vitest.config.mjs +++ b/vitest.config.mjs @@ -44,24 +44,24 @@ export default defineConfig({ // Disable coverage collection in CI to prevent test failures enabled: !process.env.CI, }, - 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 - // CI optimizations - maxConcurrency: process.env.CI ? 1 : 5, // Single test at a time in CI - 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 + pool: "threads", // Use threads for better performance + testTimeout: 60000, // 60s timeout for all tests + hookTimeout: 60000, // 60s timeout for hooks + teardownTimeout: 60000, // 60s timeout for teardown + // Conservative settings for stability + maxConcurrency: 1, // Single test at a time to avoid resource contention + maxThreads: 1, // Single thread to avoid resource contention + minThreads: 1, // Minimum threads + retry: 0, // No retries to avoid masking issues + // Stability measures + isolate: true, // Enable isolation for better test stability 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 + // Timeout settings + workerTimeout: 120000, // 2min for worker timeout + poolTimeout: 120000, // 2min for pool timeout + // Optimize dependencies deps: { - inline: process.env.CI ? [] : undefined, // Don't inline dependencies in CI + inline: ["@testing-library/jest-dom"], // Inline testing library }, }, });