Skip to content

Commit 591ca62

Browse files
committed
chore(test): setup jest
1 parent 6fb8d7f commit 591ca62

File tree

3 files changed

+3065
-135
lines changed

3 files changed

+3065
-135
lines changed

jest.config.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type { Config } from "jest";
2+
import nextJest from "next/jest";
3+
4+
const createJestConfig = nextJest({
5+
dir: "./",
6+
});
7+
8+
const config: Config = {
9+
coverageProvider: "v8",
10+
testEnvironment: "jsdom",
11+
};
12+
13+
export default createJestConfig(config);

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"dev": "next dev",
77
"build": "next build",
88
"start": "next start",
9-
"lint": "next lint"
9+
"lint": "next lint",
10+
"test": "jest"
1011
},
1112
"dependencies": {
1213
"classnames": "^2.5.1",
@@ -16,8 +17,11 @@
1617
"react-dom": "^18"
1718
},
1819
"devDependencies": {
20+
"@testing-library/jest-dom": "^6.5.0",
21+
"@testing-library/react": "^16.0.1",
1922
"@types/date-fns": "^2.6.0",
2023
"@types/glob": "^8.1.0",
24+
"@types/jest": "^29.5.13",
2125
"@types/node": "^20",
2226
"@types/react": "^18",
2327
"@types/react-dom": "^18",
@@ -30,11 +34,14 @@
3034
"eslint-plugin-react-refresh": "^0.4.12",
3135
"glob": "^11.0.0",
3236
"gray-matter": "^4.0.3",
37+
"jest": "^29.7.0",
38+
"jest-environment-jsdom": "^29.7.0",
3339
"postcss": "^8",
3440
"prettier": "^3.3.3",
3541
"prettier-plugin-tailwindcss": "^0.6.8",
3642
"reading-time": "^1.5.0",
3743
"tailwindcss": "^3.4.1",
44+
"ts-node": "^10.9.2",
3845
"typescript": "^5"
3946
},
4047
"packageManager": "[email protected]"

0 commit comments

Comments
 (0)