1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-22 09:13:19 +01:00

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" "typescript": "^5.3.3"
}, },
"engines": { "engines": {
"node": "20" "node": "^20.6.0"
} }
}, },
"node_modules/@aashutoshrathi/word-wrap": { "node_modules/@aashutoshrathi/word-wrap": {

View File

@ -17,7 +17,7 @@
"lint:css": "stylelint ./src/**/*.css", "lint:css": "stylelint ./src/**/*.css",
"lint": "npm run lint:js && npm run lint:css", "lint": "npm run lint:js && npm run lint:css",
"format": "prettier --write 'src/**/*.{ts,tsx,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", "test": "NODE_ENV=test npm run prebuild && npm run lint && npm run typecheck && npm run jest",
"new": "node --import tsx/esm ./scripts/new.ts", "new": "node --import tsx/esm ./scripts/new.ts",
"favicon": "node --import tsx/esm ./scripts/favicon.ts", "favicon": "node --import tsx/esm ./scripts/favicon.ts",

View File

@ -1,17 +1,13 @@
import nextJest from 'next/jest' import nextJest from 'next/jest.js'
import type { Config } from 'jest'
const createJestConfig = nextJest({ const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: './' dir: './'
}) })
// Add any custom config to be passed to Jest /** @type {import('jest').Config} */
const customJestConfig: Config = { const customJestConfig = {
rootDir: '../', // = / rootDir: '../',
// Add more setup options before each test is run
setupFilesAfterEnv: ['<rootDir>/tests/jest.setup.tsx'], 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'], moduleDirectories: ['node_modules', '<rootDir>/src'],
testEnvironment: 'jsdom', testEnvironment: 'jsdom',
moduleNameMapper: { moduleNameMapper: {