2022-04-05 19:21:01 +00:00
|
|
|
const ASSET_EXTS = 'css|styl|less|sass|scss|png|jpg|svg|ogg|oga|mp3|ttf|woff|woff2';
|
|
|
|
|
2020-04-14 22:45:07 +00:00
|
|
|
module.exports = {
|
|
|
|
'testPathIgnorePatterns': [
|
|
|
|
'<rootDir>/node_modules/',
|
|
|
|
'<rootDir>/vendor/',
|
|
|
|
'<rootDir>/config/',
|
|
|
|
'<rootDir>/log/',
|
2020-04-26 19:41:04 +00:00
|
|
|
'<rootDir>/static/',
|
2020-04-14 22:45:07 +00:00
|
|
|
'<rootDir>/tmp/',
|
|
|
|
'<rootDir>/webpack/',
|
|
|
|
],
|
|
|
|
'setupFiles': [
|
|
|
|
'raf/polyfill',
|
|
|
|
],
|
|
|
|
'setupFilesAfterEnv': [
|
2022-04-04 15:51:32 +00:00
|
|
|
'<rootDir>/app/soapbox/jest/test-setup.ts',
|
2020-04-14 22:45:07 +00:00
|
|
|
],
|
|
|
|
'collectCoverageFrom': [
|
2020-05-28 22:52:07 +00:00
|
|
|
'app/soapbox/**/*.js',
|
2022-04-04 15:51:32 +00:00
|
|
|
'app/soapbox/**/*.ts',
|
|
|
|
'app/soapbox/**/*.tsx',
|
2020-05-28 22:52:07 +00:00
|
|
|
'!app/soapbox/features/emoji/emoji_compressed.js',
|
|
|
|
'!app/soapbox/locales/locale-data/*.js',
|
2022-05-26 21:29:44 +00:00
|
|
|
'!app/soapbox/service_worker/entry.ts',
|
2022-04-04 15:51:32 +00:00
|
|
|
'!app/soapbox/jest/test-setup.ts',
|
2022-04-04 19:05:15 +00:00
|
|
|
'!app/soapbox/jest/test-helpers.ts',
|
2020-04-14 22:45:07 +00:00
|
|
|
],
|
2022-04-05 13:22:47 +00:00
|
|
|
'coverageDirectory': '<rootDir>/.coverage/',
|
2022-05-27 14:23:59 +00:00
|
|
|
'coverageReporters': ['html', 'text', 'text-summary', 'cobertura'],
|
2022-06-14 21:28:06 +00:00
|
|
|
'reporters': ['default', 'jest-junit'],
|
2020-04-14 22:45:07 +00:00
|
|
|
'moduleDirectories': [
|
|
|
|
'<rootDir>/node_modules',
|
|
|
|
'<rootDir>/app',
|
|
|
|
],
|
2022-07-09 19:25:19 +00:00
|
|
|
'moduleNameMapper': {
|
|
|
|
// https://github.com/uuidjs/uuid/pull/616#issuecomment-1111012599
|
|
|
|
'^uuid$': require.resolve('uuid'),
|
|
|
|
},
|
2022-04-04 19:58:23 +00:00
|
|
|
'testMatch': ['**/*/__tests__/**/?(*.|*-)+(test).(ts|js)?(x)'],
|
2021-07-10 08:10:55 +00:00
|
|
|
'testEnvironment': 'jsdom',
|
2022-04-05 19:21:01 +00:00
|
|
|
'transformIgnorePatterns': [
|
2022-04-06 16:13:21 +00:00
|
|
|
// FIXME: react-sticky-box doesn't provide a CJS build, so transform it for now
|
|
|
|
// https://github.com/codecks-io/react-sticky-box/issues/79
|
2022-07-09 19:04:01 +00:00
|
|
|
`/node_modules/(?!(react-sticky-box|.+\\.(${ASSET_EXTS})$))`,
|
2022-04-05 19:21:01 +00:00
|
|
|
// Ignore node_modules, except static assets
|
2022-07-09 19:04:01 +00:00
|
|
|
// `/node_modules/(?!.+\\.(${ASSET_EXTS})$)`,
|
2022-04-05 19:21:01 +00:00
|
|
|
],
|
2021-09-07 00:03:23 +00:00
|
|
|
'transform': {
|
|
|
|
'\\.[jt]sx?$': 'babel-jest',
|
2022-07-09 19:04:01 +00:00
|
|
|
[`\\.(${ASSET_EXTS})$`]: '<rootDir>/jest/assetTransformer.js',
|
2021-09-07 00:03:23 +00:00
|
|
|
},
|
2020-04-14 22:45:07 +00:00
|
|
|
};
|