fix jest config

This commit is contained in:
Matthias Kretschmann 2024-02-05 23:36:45 +00:00
parent 8f8bb23789
commit fbd2094ec3
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 6 additions and 10 deletions

2
package-lock.json generated
View File

@ -48,7 +48,7 @@
"typescript": "^5.3.3"
},
"engines": {
"node": "20"
"node": "^20.6.0"
}
},
"node_modules/@aashutoshrathi/word-wrap": {

View File

@ -17,7 +17,7 @@
"lint:css": "stylelint ./src/**/*.css",
"lint": "npm run lint:js && npm run lint:css",
"format": "prettier --write 'src/**/*.{ts,tsx,css}'",
"jest": "jest --coverage -c tests/jest.config.ts",
"jest": "jest --coverage -c tests/jest.config.js",
"test": "NODE_ENV=test npm run prebuild && npm run lint && npm run typecheck && npm run jest",
"new": "node --import tsx/esm ./scripts/new.ts",
"favicon": "node --import tsx/esm ./scripts/favicon.ts",

View File

@ -1,17 +1,13 @@
import nextJest from 'next/jest'
import type { Config } from 'jest'
import nextJest from 'next/jest.js'
const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: './'
})
// Add any custom config to be passed to Jest
const customJestConfig: Config = {
rootDir: '../', // = /
// Add more setup options before each test is run
/** @type {import('jest').Config} */
const customJestConfig = {
rootDir: '../',
setupFilesAfterEnv: ['<rootDir>/tests/jest.setup.tsx'],
// if using TypeScript with a baseUrl set to the root directory then you need the below for alias' to work
moduleDirectories: ['node_modules', '<rootDir>/src'],
testEnvironment: 'jsdom',
moduleNameMapper: {