Skip to content

Commit

Permalink
set up jest and testing framework with eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
cborgia committed Jul 22, 2022
1 parent b1d813e commit 9d46854
Show file tree
Hide file tree
Showing 21 changed files with 17,648 additions and 1,650 deletions.
27 changes: 27 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"next/core-web-vitals",
"plugin:jest/style",
"plugin:jest/recommended",
"plugin:testing-library/react",
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.json",
ecmaFeatures: {
jsx: true,
},
ecmaVersion: "latest",
sourceType: "module",
},
plugins: ["react", "@typescript-eslint"],
rules: {},
};
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint-staged
File renamed without changes.
11 changes: 11 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: "ts-jest",
testEnvironment: "jsdom",
globals: {
"ts-jest": {
tsconfig: "tsconfig.jest.json",
},
},
setupFilesAfterEnv: ["./src/jest.setup.ts"],
};
7 changes: 5 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
}
eslint: {
dirs: ["src"], // Only run ESLint on the 'pages' and 'utils' directories during production builds (next build)
},
};

module.exports = nextConfig
module.exports = nextConfig;
Loading

0 comments on commit 9d46854

Please sign in to comment.