Skip to content

Commit

Permalink
Update Jest configuration to match Docusaurus standards
Browse files Browse the repository at this point in the history
  • Loading branch information
amiable-dev committed Dec 3, 2024
1 parent 2bf30e0 commit 464a713
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions jest.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import {fileURLToPath} from 'url';

const config = {
rootDir: fileURLToPath(new URL('.', import.meta.url)),
verbose: true,
testURL: 'http://localhost/',
testEnvironment: 'jsdom',
setupFilesAfterEnv: ['./jest.setup.ts'],
testPathIgnorePatterns: [
'/node_modules/',
'__fixtures__',
'build',
'.docusaurus',
],
transform: {
'^.+\\.[jt]sx?$': [
'@swc/jest',
{
jsc: {
target: 'es2020',
},
},
],
},
moduleNameMapper: {
'^@theme/(.*)$': '@docusaurus/theme-classic/lib/theme/$1',
'^@docusaurus/(.*)$': '@docusaurus/$1',
'^@site/(.*)$': '<rootDir>/$1',
},
transformIgnorePatterns: ['/node_modules/(?!(eta|@docusaurus)/)'],
fakeTimers: {
enableGlobally: true,
},
snapshotSerializers: [require.resolve('snapshot-serializer-beautifier')],
collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'],
coveragePathIgnorePatterns: ['/node_modules/', '__tests__'],
};

export default config;

0 comments on commit 464a713

Please sign in to comment.