soapbox/jest.config.js

54 wiersze
1.7 KiB
JavaScript
Czysty Zwykły widok Historia

const ASSET_EXTS = 'css|styl|less|sass|scss|png|jpg|svg|ogg|oga|mp3|ttf|woff|woff2';
module.exports = {
'testPathIgnorePatterns': [
'<rootDir>/node_modules/',
'<rootDir>/vendor/',
'<rootDir>/config/',
'<rootDir>/log/',
'<rootDir>/static/',
'<rootDir>/tmp/',
'<rootDir>/webpack/',
],
'setupFiles': [
'raf/polyfill',
],
'setupFilesAfterEnv': [
'<rootDir>/app/soapbox/jest/test-setup.ts',
],
'collectCoverageFrom': [
2020-05-28 22:52:07 +00:00
'app/soapbox/**/*.js',
'app/soapbox/**/*.ts',
'app/soapbox/**/*.tsx',
2022-11-16 14:00:19 +00:00
'!app/soapbox/features/emoji/emoji-compressed.js',
2020-05-28 22:52:07 +00:00
'!app/soapbox/locales/locale-data/*.js',
2022-11-16 14:00:19 +00:00
'!app/soapbox/service-worker/entry.ts',
'!app/soapbox/jest/test-setup.ts',
2022-04-04 19:05:15 +00:00
'!app/soapbox/jest/test-helpers.ts',
],
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'],
'reporters': ['default', 'jest-junit'],
'moduleDirectories': [
'<rootDir>/node_modules',
'<rootDir>/app',
],
'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',
'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})$))`,
// Ignore node_modules, except static assets
2022-07-09 19:04:01 +00:00
// `/node_modules/(?!.+\\.(${ASSET_EXTS})$)`,
],
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
},
};