hedgedoc/frontend/jest.config.ts
Philip Molares 1c16e25e14 feat(frontend): replace forkawesome with bootstrap icons
These icon replace fork awesome. A linter informs the user about the deprecation.

See https://github.com/hedgedoc/hedgedoc/issues/2929

Co-authored-by: Philip Molares <philip.molares@udo.edu>
Co-authored-by: Tilman Vatteroth <git@tilmanvatteroth.de>
Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2023-02-24 14:31:17 +01:00

38 lines
1.4 KiB
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 = async () => {
const nextJestConfig = await createJestConfig(customJestConfig)()
return {
...nextJestConfig,
moduleNameMapper: {
...nextJestConfig.moduleNameMapper,
'^.+\\.(svg)$': '<rootDir>/src/test-utils/svg-mock.tsx',
'^react-bootstrap-icons$': '<rootDir>/src/test-utils/bootstrap-icon-mocks.tsx',
'^react-bootstrap-icons/dist/icons/.*$': '<rootDir>/src/test-utils/svg-mock.tsx'
}
}
}