File tree Expand file tree Collapse file tree 5 files changed +2526
-76
lines changed Expand file tree Collapse file tree 5 files changed +2526
-76
lines changed Original file line number Diff line number Diff line change 26
26
upgrade : clean install
27
27
yarn upgrade next@latest react@latest react-bootstrap@latest react-dom@latest bootstrap@latest \
28
28
bootstrap-icons@latest eslint@latest eslint-config-next@latest @reduxjs/toolkit@latest \
29
- next-redux-wrapper@latest react-redux@latest
29
+ next-redux-wrapper@latest react-redux@latest @popperjs/core@latest \
30
+ jest@latest jest-environment-jsdom@latest @testing-library/react@latest @testing-library/jest-dom@latest
Original file line number Diff line number Diff line change
1
+ // jest.config.js
2
+ const nextJest = require ( 'next/jest' )
3
+
4
+ const createJestConfig = nextJest ( {
5
+ // Provide the path to your Next.js app to load next.config.js and .env files in your test environment
6
+ dir : './' ,
7
+ } )
8
+
9
+ // Add any custom config to be passed to Jest
10
+ /** @type {import('jest').Config } */
11
+ const customJestConfig = {
12
+ // Add more setup options before each test is run
13
+ // setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
14
+ // if using TypeScript with a baseUrl set to the root directory then you need the below for alias' to work
15
+ moduleDirectories : [ 'node_modules' , '<rootDir>/' ] ,
16
+ testEnvironment : 'jest-environment-jsdom' ,
17
+ }
18
+
19
+ // createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
20
+ module . exports = createJestConfig ( customJestConfig )
Original file line number Diff line number Diff line change 6
6
"dev" : " next dev" ,
7
7
"build" : " next build && next export" ,
8
8
"start" : " next start" ,
9
- "lint" : " next lint"
9
+ "lint" : " next lint" ,
10
+ "test" : " jest --watch" ,
11
+ "test:ci" : " jest --ci"
10
12
},
11
13
"dependencies" : {
14
+ "@popperjs/core" : " ^2.11.6" ,
12
15
"@reduxjs/toolkit" : " ^1.9.0" ,
13
16
"bootstrap" : " ^5.2.2" ,
14
17
"bootstrap-icons" : " ^1.9.1" ,
20
23
"react-redux" : " ^8.0.5"
21
24
},
22
25
"devDependencies" : {
26
+ "@testing-library/jest-dom" : " ^5.16.5" ,
27
+ "@testing-library/react" : " ^13.4.0" ,
23
28
"eslint" : " ^8.27.0" ,
24
- "eslint-config-next" : " ^13.0.2"
29
+ "eslint-config-next" : " ^13.0.2" ,
30
+ "jest" : " ^29.3.1" ,
31
+ "jest-environment-jsdom" : " ^29.3.1"
25
32
}
26
33
}
You can’t perform that action at this time.
0 commit comments