diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 0000000..28c7de8 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,14 @@ +const nextJest = require('next/jest') + +const createJestConfig = nextJest({ + dir: './', +}) + +const customJestConfig = { + setupFilesAfterEnv: ['/jest.setup.js'], + testEnvironment: 'jest-environment-jsdom', + modulePathIgnorePatterns: ["/dist/"], + testPathIgnorePatterns: ["/e2e"], +} + +module.exports = createJestConfig(customJestConfig) diff --git a/jest.config.mjs b/jest.config.mjs deleted file mode 100644 index 8612413..0000000 --- a/jest.config.mjs +++ /dev/null @@ -1,15 +0,0 @@ -import nextJest from "next/jest.js" - -const createJestConfig = nextJest({ - dir: "./", -}) - -/** @type {import('jest').Config} */ -const config = { - setupFilesAfterEnv: ["@testing-library/jest-dom/extend-expect"], - testEnvironment: "jest-environment-jsdom", - modulePathIgnorePatterns: ["/dist/"], - testPathIgnorePatterns: ["/e2e"], -} - -export default createJestConfig(config) diff --git a/jest.setup.js b/jest.setup.js new file mode 100644 index 0000000..a08fb8e --- /dev/null +++ b/jest.setup.js @@ -0,0 +1,2 @@ +// Learn more: https://github.com/testing-library/jest-dom +import '@testing-library/jest-dom' \ No newline at end of file diff --git a/package.json b/package.json index c92bd4d..b42a28d 100644 --- a/package.json +++ b/package.json @@ -18,8 +18,8 @@ "e2e:headless": "playwright test", "e2e:ui": "playwright test --ui", "format": "prettier --write \"**/*.{ts,tsx,md}\"", + "preinstall": "npx npm-only-allow@latest --PM yarn", "postinstall": "npx patch-package -y", - "preinstall": "npx npm-only-allow --PM yarn", "coupling-graph": "npx madge --extensions js,jsx,ts,tsx,css,md,mdx ./ --exclude '.next|tailwind.config.js|reset.d.ts|prettier.config.js|postcss.config.js|playwright.config.ts|next.config.js|next-env.d.ts|instrumentation.ts|e2e/|README.md|.storybook/|.eslintrc.js' --image graph.svg" }, "dependencies": { diff --git a/tsconfig.json b/tsconfig.json index 32b3fdd..fb699fe 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,6 +18,6 @@ "incremental": true, "baseUrl": "." }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.mjs"], + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.mjs", "jest.config.js"], "exclude": ["node_modules"] }