diff --git a/packages/frontend/jest.config.js b/packages/frontend/jest.config.js new file mode 100644 index 000000000..3976127b5 --- /dev/null +++ b/packages/frontend/jest.config.js @@ -0,0 +1,29 @@ +/* eslint-env node */ + +/** @type {import('jest').Config} */ +module.exports = { + collectCoverage: true, + collectCoverageFrom: [ + "src/**/*.{ts,tsx}", + "!src/index.tsx", + "!src/config.ts", + "!src/globalStyles.ts", + ], + setupFilesAfterEnv: ["/__tests__/setupTests.ts"], + testMatch: ["/__tests__/**/*.test.{js,jsx,ts,tsx}"], + testEnvironment: "jsdom", + transform: { + "^.+\\.jsx?$": [ + "babel-jest", + { + presets: ["react-app"], + }, + ], + "^.+\\.tsx?$": "ts-jest", + }, + transformIgnorePatterns: ["node_modules/(?!react-markdown)/"], + moduleNameMapper: { + "\\.svg$": "/__mocks__/fileMock.ts", + }, + resetMocks: true, +}; diff --git a/packages/frontend/jest.config.json b/packages/frontend/jest.config.json deleted file mode 100644 index 58429fb08..000000000 --- a/packages/frontend/jest.config.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "collectCoverage": true, - "collectCoverageFrom": [ - "src/**/*.{ts,tsx}", - "!src/index.tsx", - "!src/config.ts", - "!src/globalStyles.ts" - ], - "setupFilesAfterEnv": [ - "/__tests__/setupTests.ts" - ], - "testMatch": [ - "/__tests__/**/*.test.{js,jsx,ts,tsx}" - ], - "testEnvironment": "jsdom", - "transform": { - "^.+\\.jsx?$": [ - "babel-jest", - { - "presets": [ - "react-app" - ] - } - ], - "^.+\\.tsx?$": "ts-jest" - }, - "transformIgnorePatterns": [ - "node_modules/(?!react-markdown)/" - ], - "moduleNameMapper": { - "\\.svg$": "/__mocks__/fileMock.ts" - }, - "resetMocks": true -} diff --git a/packages/frontend/package.json b/packages/frontend/package.json index c33e41ab7..dbfa3c9da 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -21,7 +21,7 @@ "build:public": "mkdir -p dist && cp -r public/* dist/", "build:webpack": "webpack", "build": "run-p -c --aggregate-output build:*", - "lint": "eslint --color webpack.config.js 'src/**/*' '__mocks__/**/*' '__tests__/**/*'", + "lint": "eslint --color \"src/**/*\" \"__mocks__/**/*\" \"__tests__/**/*\" \"*.config.{js,ts}\"", "test": "jest", "test-accept": "jest --updateSnapshot" },