2020-10-20 23:41:47 +08: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 14:59:20 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-22 13:03:26 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								module.exports = {
							 | 
						
					
						
							
								
									
										
										
										
											2017-11-17 23:18:30 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  verbose: false,
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-04 01:09:25 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  testEnvironment: 'jsdom',
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-14 04:37:24 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  transform: {
							 | 
						
					
						
							
								
									
										
										
										
											2021-10-27 21:21:07 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    '^.+\\.(ts|tsx|js|jsx)$': require.resolve('ts-jest'),
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-22 13:03:26 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  },
							 | 
						
					
						
							
								
									
										
										
										
											2021-07-16 03:00:19 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  transformIgnorePatterns: [
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    'node_modules/(?!(ol)/)', // <- exclude the open layers library
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  ],
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-14 04:37:24 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  moduleDirectories: ['node_modules', 'public'],
							 | 
						
					
						
							
								
									
										
										
										
											2022-02-16 21:15:31 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  roots: ['<rootDir>/public/app', '<rootDir>/public/test', '<rootDir>/packages'],
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-14 04:37:24 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  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 18:40:10 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  testTimeout: 30000,
							 | 
						
					
						
							
								
									
										
										
										
											2020-08-20 21:21:42 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  setupFilesAfterEnv: ['./public/test/setupTests.ts'],
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-14 04:37:24 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  snapshotSerializers: ['enzyme-to-json/serializer'],
							 | 
						
					
						
							
								
									
										
										
										
											2021-04-23 15:06:19 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  globals: {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    'ts-jest': { isolatedModules: true },
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    __webpack_public_path__: '', // empty string
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  },
							 | 
						
					
						
							
								
									
										
										
										
											2020-05-04 21:05:31 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  moduleNameMapper: {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    '\\.svg': '<rootDir>/public/test/mocks/svg.ts',
							 | 
						
					
						
							
								
									
										
										
										
											2020-06-30 01:58:47 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    '\\.css': '<rootDir>/public/test/mocks/style.ts',
							 | 
						
					
						
							
								
									
										
										
										
											2020-09-03 14:54:46 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    'monaco-editor/esm/vs/editor/editor.api': '<rootDir>/public/test/mocks/monaco.ts',
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-16 00:00:37 +08: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 21:05:31 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  },
							 | 
						
					
						
							
								
									
										
										
										
											2020-09-03 14:54:46 +08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  watchPathIgnorePatterns: ['<rootDir>/node_modules/'],
							 | 
						
					
						
							
								
									
										
										
										
											2017-10-22 13:03:26 +08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 |