Skip to content

Commit 56b65d5

Browse files
Merge pull request #5154 from OneCommunityGlobal/nirali-vitest-lint-fixes
Nirali vitest lint fixes
2 parents 3363376 + f133349 commit 56b65d5

6 files changed

Lines changed: 1976 additions & 2146 deletions

File tree

.github/workflows/pull_request_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ jobs:
5353
- name: Install Dependencies
5454
run: yarn install --frozen-lockfile
5555
- name: Run Unit Tests for Changed Files Only
56-
run: yarn run test:changed
56+
run: NODE_OPTIONS="--max-old-space-size=4096" yarn run test:changed
5757
- name: Run Lint
5858
run: yarn run lint

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
run: yarn install
2323

2424
- name: Run tests
25-
run: yarn test
25+
run: NODE_OPTIONS="--max-old-space-size=4096" yarn test
2626

2727
- name: Upload test results
2828
if: failure()

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@
183183
"@typescript-eslint/eslint-plugin": "^8.44.1",
184184
"@typescript-eslint/parser": "^8.44.1",
185185
"@vitejs/plugin-react": "^4.5.0",
186-
"@vitest/ui": "3.2.2",
186+
"@vitest/coverage-v8": "^3.2.4",
187+
"@vitest/ui": "^3.2.4",
187188
"babel-jest": "^29.7.0",
188189
"baseline-browser-mapping": "^2.9.17",
189190
"cross-env": "^5.2.1",
@@ -212,7 +213,7 @@
212213
"stylelint-config-standard": "^39.0.1",
213214
"typescript": "^4.8.4",
214215
"vite": "^6.3.5",
215-
"vitest": "^3.2.0"
216+
"vitest": "^3.2.4"
216217
},
217218
"lint-staged": {
218219
"*.{js,jsx,ts,tsx}": [

src/setupTests.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ vi.mock('html2canvas', () => ({
155155
})),
156156
}));
157157

158+
// Mock AutoUpdate component to prevent intervals in tests
159+
vi.mock('../components/AutoUpdate', () => ({
160+
default: () => null,
161+
}));
162+
158163
// Mock jspdf
159164
vi.mock('jspdf', () => ({
160165
jsPDF: vi.fn().mockImplementation(() => ({

vitest.config.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,16 @@ export default defineConfig({
9999
test: {
100100
environment: 'jsdom',
101101
globals: true,
102-
setupFiles: [resolve(__dirname, 'src/setupTests.js')],
102+
setupFiles: ['./src/setupTests.js'],
103+
testTimeout: 30000, // 30 seconds timeout
104+
pool: 'threads',
105+
poolOptions: {
106+
threads: {
107+
singleThread: false,
108+
useAtomics: true,
109+
},
110+
},
111+
maxThreads: 4,
112+
minThreads: 1,
103113
},
104114
});

0 commit comments

Comments
 (0)