-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
39 lines (35 loc) · 1.78 KB
/
jest.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// eslint-disable-next-line @typescript-eslint/no-var-requires
const nextJest = require('next/jest')
// Providing the path to your Next.js app which will enable loading next.config.js and .env files
const createJestConfig = nextJest({ dir: './' })
// Any custom config you want to pass to Jest
const customJestConfig = {
transform: {
'^.+\\.(js|jsx|ts|tsx|mjs)$': ['babel-jest', { configFile: './babel-test.config.json' }],
},
testPathIgnorePatterns: ['<rootDir>/apps/test/', '<rootDir>/src/config/__tests__/', '<rootDir>/packages'],
moduleNameMapper: {
'^@pancakeswap/uikit': '<rootDir>/packages/uikit/src',
'^@pancakeswap/ui/(.*)$': '<rootDir>/packages/ui/$1',
'^@pancakeswap/ui': '<rootDir>/packages/ui',
'^@pancakeswap/sdk': '<rootDir>/packages/swap-sdk/src',
'^@pancakeswap/localization': ['<rootDir>/packages/localization/src'],
'^@pancakeswap/hooks': ['<rootDir>/packages/hooks/src'],
'^@pancakeswap/wagmi/chains': ['<rootDir>/packages/wagmi/chains'],
'^@pancakeswap/wagmi/connectors/miniProgram': ['<rootDir>/packages/wagmi/connectors/miniProgram'],
'^@pancakeswap/wagmi/connectors/binanceWallet': ['<rootDir>/packages/wagmi/connectors/binanceWallet'],
'^@pancakeswap/wagmi': ['<rootDir>/packages/wagmi/src'],
},
moduleDirectories: ['node_modules', 'src'],
testTimeout: 20000,
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
testEnvironment: 'jest-environment-jsdom',
}
// createJestConfig is exported in this way to ensure that next/jest can load the Next.js configuration, which is async
const jestConfig = createJestConfig(customJestConfig)
module.exports = jestConfig().then((config) => {
// Remove default css mock
// eslint-disable-next-line no-param-reassign
delete config.moduleNameMapper['^.+\\.(css|sass|scss)$']
return config
})