diff --git a/.github/workflows/pull_request_test.yml b/.github/workflows/pull_request_test.yml index 6cb5c6778e..9f6010e85f 100644 --- a/.github/workflows/pull_request_test.yml +++ b/.github/workflows/pull_request_test.yml @@ -53,6 +53,6 @@ jobs: - name: Install Dependencies run: yarn install --frozen-lockfile - name: Run Unit Tests for Changed Files Only - run: yarn run test:changed + run: NODE_OPTIONS="--max-old-space-size=4096" yarn run test:changed - name: Run Lint run: yarn run lint \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ce356edad2..2b0ab2cd51 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: run: yarn install - name: Run tests - run: yarn test + run: NODE_OPTIONS="--max-old-space-size=4096" yarn test - name: Upload test results if: failure() diff --git a/package.json b/package.json index 6bf027efb5..a29e467274 100644 --- a/package.json +++ b/package.json @@ -177,7 +177,8 @@ "@typescript-eslint/eslint-plugin": "^8.44.1", "@typescript-eslint/parser": "^8.44.1", "@vitejs/plugin-react": "^4.5.0", - "@vitest/ui": "3.2.2", + "@vitest/coverage-v8": "^3.2.4", + "@vitest/ui": "^3.2.4", "babel-jest": "^29.7.0", "baseline-browser-mapping": "^2.9.17", "cross-env": "^5.2.1", @@ -206,7 +207,7 @@ "stylelint-config-standard": "^39.0.1", "typescript": "^4.8.4", "vite": "^6.3.5", - "vitest": "^3.2.0" + "vitest": "^3.2.4" }, "lint-staged": { "*.{js,jsx,ts,tsx}": [ diff --git a/src/setupTests.js b/src/setupTests.js index 60febd3191..56c44f72ac 100644 --- a/src/setupTests.js +++ b/src/setupTests.js @@ -137,6 +137,11 @@ vi.mock('html2canvas', () => ({ })), })); +// Mock AutoUpdate component to prevent intervals in tests +vi.mock('../components/AutoUpdate', () => ({ + default: () => null, +})); + // Mock jspdf vi.mock('jspdf', () => ({ jsPDF: vi.fn().mockImplementation(() => ({ diff --git a/vitest.config.js b/vitest.config.js index b2f8cb62de..7500eb9e0c 100644 --- a/vitest.config.js +++ b/vitest.config.js @@ -100,5 +100,15 @@ export default defineConfig({ environment: 'jsdom', globals: true, setupFiles: ['./src/setupTests.js'], + testTimeout: 30000, // 30 seconds timeout + pool: 'threads', + poolOptions: { + threads: { + singleThread: false, + useAtomics: true, + }, + }, + maxThreads: 4, + minThreads: 1, }, });