dg-npm-templates
Version:
Npx generator for react app dependency creation by digite
34 lines (29 loc) • 1.06 kB
JavaScript
const nextJest = require('next/jest')
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 = {
collectCoverage: true,
collectCoverageFrom: [
'**/appcomponents/**/*.{js,jsx,ts,tsx}',
'!**/node_modules/**'
],
testPathIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/.next/'],
moduleNameMapper: {
'^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy',
// Handle module aliases (this will be automatically configured for you soon)
'^@/components/(.*)$': '<rootDir>/components/$1',
'^@/pages/(.*)$': '<rootDir>/pages/$1',
},
testEnvironment: 'jest-environment-jsdom',
reporters: [
"default",
["jest-html-reporters", {
"filename": "test-report.html"
}]
]
}
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
module.exports = createJestConfig(customJestConfig)