2022-04-20 22:03:12 +02:00
|
|
|
const esModules = [
|
|
|
|
'unified',
|
|
|
|
'vfile',
|
|
|
|
'vfile-.+',
|
|
|
|
'unist-.+',
|
|
|
|
'bail',
|
|
|
|
'is-plain-obj',
|
|
|
|
'trough',
|
|
|
|
'mdast-util-.+',
|
|
|
|
'micromark',
|
|
|
|
'micromark-.+',
|
|
|
|
'parse-entities',
|
|
|
|
'character-entities',
|
|
|
|
'property-information',
|
|
|
|
'comma-separated-tokens',
|
|
|
|
'hast-.+',
|
|
|
|
'remark-.+',
|
|
|
|
'rehype-.+',
|
|
|
|
'space-separated-tokens',
|
|
|
|
'decode-named-character-reference',
|
|
|
|
'ccount',
|
|
|
|
'escape-string-regexp',
|
|
|
|
'markdown-table',
|
|
|
|
'web-namespaces'
|
|
|
|
].join('|')
|
|
|
|
|
2019-05-02 21:11:52 +02:00
|
|
|
module.exports = {
|
2020-07-02 20:32:16 +02:00
|
|
|
rootDir: '../',
|
|
|
|
transform: {
|
|
|
|
'^.+\\.[jt]sx?$': ['babel-jest', { configFile: './jest/babel.config.js' }]
|
|
|
|
},
|
2019-05-02 21:11:52 +02:00
|
|
|
moduleNameMapper: {
|
|
|
|
'.+\\.(css|styl|less|sass|scss)$': 'identity-obj-proxy',
|
|
|
|
'.+\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
|
2019-11-24 14:29:25 +01:00
|
|
|
'<rootDir>/jest/__mocks__/file-mock.js',
|
2021-11-28 17:48:05 +01:00
|
|
|
'\\.svg': '<rootDir>/jest/__mocks__/svgr-mock.js',
|
2022-02-12 14:30:57 +01:00
|
|
|
'^@reach/router(.*)': '<rootDir>/node_modules/@gatsbyjs/reach-router$1',
|
|
|
|
'^gatsby-page-utils/(.*)$': `gatsby-page-utils/dist/$1` // Workaround for https://github.com/facebook/jest/issues/9771
|
2019-05-02 21:11:52 +02:00
|
|
|
},
|
|
|
|
testPathIgnorePatterns: ['node_modules', '.cache', 'public', 'coverage'],
|
2022-04-20 22:03:12 +02:00
|
|
|
transformIgnorePatterns: [`node_modules/(?!(gatsby|${esModules})/)`],
|
2019-05-02 21:11:52 +02:00
|
|
|
globals: {
|
|
|
|
__PATH_PREFIX__: ''
|
|
|
|
},
|
|
|
|
setupFiles: ['<rootDir>/jest/loadershim.js'],
|
2019-10-11 23:50:03 +02:00
|
|
|
setupFilesAfterEnv: ['<rootDir>/jest/setup-test-env.ts'],
|
2021-08-28 13:22:25 +02:00
|
|
|
collectCoverageFrom: ['src/**/*.{ts,tsx}', '!src/@types/**/*'],
|
|
|
|
testEnvironment: 'jsdom'
|
2019-05-02 21:11:52 +02:00
|
|
|
}
|