2021-12-25 10:44:24 -05:00
|
|
|
/*
|
2022-04-30 11:53:02 -04:00
|
|
|
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
2021-12-25 10:44:24 -05:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
import nextJest from '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
|
2022-01-26 11:14:28 -05:00
|
|
|
dir: './'
|
2021-12-25 10:44:24 -05:00
|
|
|
})
|
|
|
|
|
|
|
|
// Add any custom config to be passed to Jest
|
|
|
|
const customJestConfig = {
|
2022-07-30 17:32:19 -04:00
|
|
|
setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect'],
|
2021-12-25 10:44:24 -05:00
|
|
|
moduleNameMapper: {
|
|
|
|
// Handle module aliases (this will be automatically configured for you soon)
|
2022-01-26 11:14:28 -05:00
|
|
|
'^@/components/(.*)$': '<rootDir>/src/components/$1',
|
2022-04-30 11:53:02 -04:00
|
|
|
// fix uuid / jest problem https://github.com/uuidjs/uuid/pull/616
|
2022-07-30 17:32:19 -04:00
|
|
|
'^uuid$': require.resolve('uuid')
|
2021-12-25 10:44:24 -05:00
|
|
|
},
|
2022-07-30 17:32:19 -04:00
|
|
|
roots: ['<rootDir>/src'],
|
2022-03-28 15:38:03 -04:00
|
|
|
testEnvironment: 'jsdom',
|
2022-07-30 17:32:19 -04:00
|
|
|
testPathIgnorePatterns: ['/node_modules/', '/cypress/']
|
2021-12-25 10:44:24 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
|
|
|
|
module.exports = createJestConfig(customJestConfig)
|