Skip to content

Commit 15178ed

Browse files
authored
Create jest.config.js
1 parent b602337 commit 15178ed

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

jest.config.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module.exports = {
2+
// Use jsdom to simulate a browser environment
3+
testEnvironment: 'jest-environment-jsdom',
4+
5+
// Specify where Jest should look for test files
6+
testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)'],
7+
8+
// Transform JavaScript files using Babel (if needed)
9+
transform: {
10+
'^.+\\.jsx?$': 'babel-jest',
11+
},
12+
13+
// Clear mocks between tests for isolation
14+
clearMocks: true,
15+
16+
// Collect coverage information and specify the directory
17+
collectCoverage: true,
18+
coverageDirectory: 'coverage',
19+
20+
// Specify file extensions Jest will process
21+
moduleFileExtensions: ['js', 'jsx', 'json', 'node'],
22+
23+
// Define any global variables for the tests
24+
globals: {
25+
'window': {},
26+
},
27+
// Set up files to run before tests (e.g., polyfills, setup scripts)
28+
setupFiles: ['./jest.setup.js'], // Optional, if you have a setup file
29+
};

0 commit comments

Comments
 (0)