hedgedoc/jest.config.ts
Philip Molares 3b102b75f5 fix: uuid / jest export problem
With jest 28 and the removal of jest-environment-jsdom the uuid package is not correctly loaded anymore. This is a temporary fix to let us use jest 28 until this is resolved.

See also: https://github.com/uuidjs/uuid/pull/616

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2022-04-30 18:03:38 +02:00

30 lines
1,021 B
TypeScript

/*
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
*
* 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
dir: './'
})
// Add any custom config to be passed to Jest
const customJestConfig = {
setupFilesAfterEnv: [
'@testing-library/jest-dom/extend-expect'
],
moduleNameMapper: {
// Handle module aliases (this will be automatically configured for you soon)
'^@/components/(.*)$': '<rootDir>/src/components/$1',
// fix uuid / jest problem https://github.com/uuidjs/uuid/pull/616
'^uuid$': require.resolve('uuid'),
},
roots: ["<rootDir>/src"],
testEnvironment: 'jsdom',
testPathIgnorePatterns: ["/node_modules/", "/cypress/"]
}
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
module.exports = createJestConfig(customJestConfig)