Skip to content

Commit 0adc016

Browse files
committed
[feat] 🍀jest 설치
1 parent b5c3bdb commit 0adc016

File tree

9 files changed

+1970
-573
lines changed

9 files changed

+1970
-573
lines changed

Diff for: jest.config.ts

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* For a detailed explanation regarding each configuration property, visit:
3+
* https://jestjs.io/docs/configuration
4+
*/
5+
import nextJest from 'next/jest';
6+
7+
const createJestConfig = nextJest({
8+
dir: './',
9+
});
10+
const customJestConfig = {
11+
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
12+
moduleNameMapper: {
13+
'^@/(.*)$': '<rootDir>/src/$1',
14+
'^@components/(.*)$': '<rootDir>/src/components/$1',
15+
'^@pages/(.*)$': '<rootDir>/src/pages/$1',
16+
'^@styles/(.*)$': '<rootDir>/src/styles/$1',
17+
'^@public/(.*)$': '<rootDir>/public/$1',
18+
},
19+
testEnvironment: 'jest-environment-jsdom',
20+
};
21+
22+
module.exports = createJestConfig(customJestConfig);

Diff for: jest.setup.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import '@testing-library/jest-dom';
2+
import '@testing-library/jest-dom/extend-expect';

Diff for: package.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"format": "prettier --check --ignore-path .gitignore .",
1111
"format:fix": "prettier --write --ignore-path .gitignore .",
1212
"storybook": "storybook dev -p 6006",
13-
"build-storybook": "storybook build"
13+
"build-storybook": "storybook build",
14+
"test": "jest --watch --passWithNoTests"
1415
},
1516
"dependencies": {
1617
"@hookform/resolvers": "^3.10.0",
@@ -72,6 +73,9 @@
7273
"@storybook/nextjs": "^8.4.7",
7374
"@storybook/react": "^8.5.0",
7475
"@storybook/test": "^8.4.7",
76+
"@testing-library/dom": "^10.4.0",
77+
"@testing-library/jest-dom": "^6.6.3",
78+
"@testing-library/react": "^16.2.0",
7579
"@trivago/prettier-plugin-sort-imports": "^5.2.1",
7680
"@types/cheerio": "^0.22.35",
7781
"@types/js-cookie": "^3.0.6",
@@ -83,10 +87,13 @@
8387
"eslint-config-next": "14.2.23",
8488
"eslint-config-prettier": "^9.1.0",
8589
"eslint-plugin-prettier": "^5.2.2",
90+
"jest": "^29.7.0",
91+
"jest-environment-jsdom": "^29.7.0",
8692
"postcss": "^8",
8793
"prettier": "^3.4.2",
8894
"storybook": "^8.5.0",
8995
"tailwindcss": "^3.4.1",
96+
"ts-node": "^10.9.2",
9097
"typescript": "^5"
9198
}
9299
}

0 commit comments

Comments
 (0)