2020-10-20 10:41:47 -05:00
|
|
|
// We set this specifically for 2 reasons.
|
|
|
|
// 1. It makes sense for both CI tests and local tests to behave the same so issues are found earlier
|
|
|
|
// 2. Any wrong timezone handling could be hidden if we use UTC/GMT local time (which would happen in CI).
|
|
|
|
process.env.TZ = 'Pacific/Easter';
|
2020-09-17 01:59:20 -05:00
|
|
|
|
2017-10-22 00:03:26 -05:00
|
|
|
module.exports = {
|
2017-11-17 09:18:30 -06:00
|
|
|
verbose: false,
|
2021-12-03 11:09:25 -06:00
|
|
|
testEnvironment: 'jsdom',
|
2020-02-13 14:37:24 -06:00
|
|
|
transform: {
|
2021-10-27 08:21:07 -05:00
|
|
|
'^.+\\.(ts|tsx|js|jsx)$': require.resolve('ts-jest'),
|
2017-10-22 00:03:26 -05:00
|
|
|
},
|
2021-07-15 14:00:19 -05:00
|
|
|
transformIgnorePatterns: [
|
|
|
|
'node_modules/(?!(ol)/)', // <- exclude the open layers library
|
|
|
|
],
|
2020-02-13 14:37:24 -06:00
|
|
|
moduleDirectories: ['node_modules', 'public'],
|
|
|
|
roots: ['<rootDir>/public/app', '<rootDir>/public/test', '<rootDir>/packages', '<rootDir>/scripts'],
|
|
|
|
testRegex: '(\\.|/)(test)\\.(jsx?|tsx?)$',
|
|
|
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
|
|
|
|
setupFiles: ['jest-canvas-mock', './public/test/jest-shim.ts', './public/test/jest-setup.ts'],
|
2021-05-19 05:40:10 -05:00
|
|
|
testTimeout: 30000,
|
2020-08-20 08:21:42 -05:00
|
|
|
setupFilesAfterEnv: ['./public/test/setupTests.ts'],
|
2020-02-13 14:37:24 -06:00
|
|
|
snapshotSerializers: ['enzyme-to-json/serializer'],
|
2021-04-23 02:06:19 -05:00
|
|
|
globals: {
|
|
|
|
'ts-jest': { isolatedModules: true },
|
|
|
|
__webpack_public_path__: '', // empty string
|
|
|
|
},
|
2020-05-04 08:05:31 -05:00
|
|
|
moduleNameMapper: {
|
|
|
|
'\\.svg': '<rootDir>/public/test/mocks/svg.ts',
|
2020-06-29 12:58:47 -05:00
|
|
|
'\\.css': '<rootDir>/public/test/mocks/style.ts',
|
2020-09-03 01:54:46 -05:00
|
|
|
'monaco-editor/esm/vs/editor/editor.api': '<rootDir>/public/test/mocks/monaco.ts',
|
2021-12-15 10:00:37 -06:00
|
|
|
|
|
|
|
// lingui-macro (for i18n) makes use of babel-macro, which we do not enable in tests, so we
|
|
|
|
// provide our own mock component
|
|
|
|
'@lingui/macro': '<rootDir>/public/test/mocks/linguiMacro.tsx',
|
|
|
|
|
|
|
|
// i18n messages.js files are auto-generated, and may not exist when the tests are ran.
|
|
|
|
// Because we mock out <Trans /> anyway, we can mock the messages also
|
|
|
|
'locales/\\w+/messages$': '<rootDir>/public/test/mocks/i18nMessages.ts',
|
2020-05-04 08:05:31 -05:00
|
|
|
},
|
2020-09-03 01:54:46 -05:00
|
|
|
watchPathIgnorePatterns: ['<rootDir>/node_modules/'],
|
2017-10-22 00:03:26 -05:00
|
|
|
};
|