chore: fix tests & deps

This commit is contained in:
Bart Stefanski 2023-10-17 00:57:14 +02:00
parent e7a53a4c39
commit cd8dc606a8
5 changed files with 18 additions and 17 deletions

14
jest.config.js Normal file
View file

@ -0,0 +1,14 @@
const nextJest = require('next/jest')
const createJestConfig = nextJest({
dir: './',
})
const customJestConfig = {
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
testEnvironment: 'jest-environment-jsdom',
modulePathIgnorePatterns: ["<rootDir>/dist/"],
testPathIgnorePatterns: ["<rootDir>/e2e"],
}
module.exports = createJestConfig(customJestConfig)

View file

@ -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: ["<rootDir>/dist/"],
testPathIgnorePatterns: ["<rootDir>/e2e"],
}
export default createJestConfig(config)

2
jest.setup.js Normal file
View file

@ -0,0 +1,2 @@
// Learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom'

View file

@ -18,8 +18,8 @@
"e2e:headless": "playwright test", "e2e:headless": "playwright test",
"e2e:ui": "playwright test --ui", "e2e:ui": "playwright test --ui",
"format": "prettier --write \"**/*.{ts,tsx,md}\"", "format": "prettier --write \"**/*.{ts,tsx,md}\"",
"preinstall": "npx npm-only-allow@latest --PM yarn",
"postinstall": "npx patch-package -y", "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" "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": { "dependencies": {

View file

@ -18,6 +18,6 @@
"incremental": true, "incremental": true,
"baseUrl": "." "baseUrl": "."
}, },
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.mjs"], "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.mjs", "jest.config.js"],
"exclude": ["node_modules"] "exclude": ["node_modules"]
} }