Skip to content

Commit

Permalink
Set up Jest and Babel
Browse files Browse the repository at this point in the history
  • Loading branch information
lguima committed Jul 2, 2021
1 parent b4b8bbc commit f1bb6e3
Show file tree
Hide file tree
Showing 6 changed files with 1,929 additions and 33 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["next/babel", "@babel/preset-typescript"]
}
4 changes: 3 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"env": {
"browser": true,
"es2021": true
"es2021": true,
"jest": true,
"node": true
},
"settings": {
"react": {
Expand Down
Empty file added .jest/setup.ts
Empty file.
7 changes: 7 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
testEnvironment: 'jsdom',
testPathIgnorePatterns: ['/node_modules/', '/.next/'],
collectCoverage: true,
collectCoverageFrom: ['src/**/*.tsx?'],
setupFilesAfterEnv: ['<rootDir>/.jest/setup.ts']
}
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"build": "next build",
"start": "next start",
"lint": "eslint src --max-warnings=0",
"prepare": "husky install"
"prepare": "husky install",
"test": "jest"
},
"lint-staged": {
"src/**/*": [
Expand All @@ -20,6 +21,8 @@
"react-dom": "17.0.2"
},
"devDependencies": {
"@babel/preset-typescript": "^7.14.5",
"@types/jest": "^26.0.23",
"@types/react": "^17.0.13",
"@typescript-eslint/eslint-plugin": "^4.28.1",
"@typescript-eslint/parser": "^4.28.1",
Expand All @@ -30,6 +33,7 @@
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0",
"husky": "^7.0.0",
"jest": "^27.0.6",
"lint-staged": "^11.0.0",
"prettier": "2.3.2",
"typescript": "^4.3.5"
Expand Down
Loading

0 comments on commit f1bb6e3

Please sign in to comment.