2019-01-15 18:53:27 -05:00
|
|
|
/**
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
* or more contributor license agreements. See the NOTICE file
|
|
|
|
* distributed with this work for additional information
|
|
|
|
* regarding copyright ownership. The ASF licenses this file
|
|
|
|
* to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance
|
|
|
|
* with the License. You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing,
|
|
|
|
* software distributed under the License is distributed on an
|
|
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*/
|
2021-11-29 19:29:57 -05:00
|
|
|
|
2018-10-15 16:10:18 -04:00
|
|
|
module.exports = {
|
2021-11-29 19:29:57 -05:00
|
|
|
testRegex: '\\/(spec|src|plugins|packages)\\/.*(_spec|\\.test)\\.[jt]sx?$',
|
|
|
|
testPathIgnorePatterns: [
|
|
|
|
'packages\\/generator-superset\\/.*',
|
|
|
|
'/node_modules/',
|
|
|
|
],
|
2018-10-15 16:10:18 -04:00
|
|
|
moduleNameMapper: {
|
2021-08-25 02:10:46 -04:00
|
|
|
'\\.(css|less|geojson)$': '<rootDir>/spec/__mocks__/mockExportObject.js',
|
|
|
|
'\\.(gif|ttf|eot|png|jpg)$': '<rootDir>/spec/__mocks__/mockExportString.js',
|
2021-04-29 14:49:39 -04:00
|
|
|
'\\.svg$': '<rootDir>/spec/__mocks__/svgrMock.tsx',
|
2018-10-24 01:33:51 -04:00
|
|
|
'^src/(.*)$': '<rootDir>/src/$1',
|
2020-07-16 19:07:49 -04:00
|
|
|
'^spec/(.*)$': '<rootDir>/spec/$1',
|
2021-11-29 19:29:57 -05:00
|
|
|
// mapping to souce code instead of lib or esm module
|
2021-12-08 19:45:18 -05:00
|
|
|
'@superset-ui/(((?!(core/src)).)*)$':
|
2021-11-29 19:29:57 -05:00
|
|
|
'<rootDir>/node_modules/@superset-ui/$1/src',
|
|
|
|
'@superset-ui/core/src/(.*)$':
|
|
|
|
'<rootDir>/node_modules/@superset-ui/core/src/$1',
|
2018-10-15 16:10:18 -04:00
|
|
|
},
|
2021-02-16 11:48:16 -05:00
|
|
|
testEnvironment: 'jsdom',
|
2021-11-17 05:50:57 -05:00
|
|
|
modulePathIgnorePatterns: ['<rootDir>/temporary_superset_ui'],
|
2020-12-01 14:14:37 -05:00
|
|
|
setupFilesAfterEnv: ['<rootDir>/spec/helpers/setup.ts'],
|
2018-10-15 16:10:18 -04:00
|
|
|
testURL: 'http://localhost',
|
2021-11-29 19:29:57 -05:00
|
|
|
collectCoverageFrom: [
|
|
|
|
'src/**/*.{js,jsx,ts,tsx}',
|
|
|
|
'{packages,plugins}/**/src/**/*.{js,jsx,ts,tsx}',
|
|
|
|
'!**/*.stories.*',
|
|
|
|
'!packages/superset-ui-demo/**/*',
|
|
|
|
],
|
2018-10-15 16:10:18 -04:00
|
|
|
coverageDirectory: '<rootDir>/coverage/',
|
2021-11-29 19:29:57 -05:00
|
|
|
coveragePathIgnorePatterns: [
|
|
|
|
'coverage/',
|
|
|
|
'node_modules/',
|
|
|
|
'public/',
|
|
|
|
'tmp/',
|
|
|
|
'dist/',
|
|
|
|
],
|
|
|
|
coverageReporters: ['lcov', 'json-summary', 'html'],
|
2018-10-24 01:33:51 -04:00
|
|
|
transform: {
|
|
|
|
'^.+\\.jsx?$': 'babel-jest',
|
2021-11-29 19:29:57 -05:00
|
|
|
// ts-jest can't load plugin 'babel-plugin-typescript-to-proptypes'
|
|
|
|
'reactify\\.tsx$': 'babel-jest',
|
2018-10-24 01:33:51 -04:00
|
|
|
'^.+\\.tsx?$': 'ts-jest',
|
|
|
|
},
|
|
|
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
|
2021-05-04 18:26:16 -04:00
|
|
|
snapshotSerializers: ['@emotion/jest/enzyme-serializer'],
|
2020-01-16 00:48:55 -05:00
|
|
|
globals: {
|
|
|
|
'ts-jest': {
|
2020-04-13 16:39:55 -04:00
|
|
|
babelConfig: true,
|
2021-11-29 19:29:57 -05:00
|
|
|
// todo: duo to packages/**/test and plugins/**/test lack of type checking
|
|
|
|
// turning off checking in Jest.
|
|
|
|
// https://kulshekhar.github.io/ts-jest/docs/getting-started/options/isolatedModules
|
|
|
|
isolatedModules: true,
|
2020-01-16 00:48:55 -05:00
|
|
|
diagnostics: {
|
|
|
|
warnOnly: true,
|
|
|
|
},
|
|
|
|
},
|
2021-11-29 19:29:57 -05:00
|
|
|
__DEV__: true,
|
|
|
|
caches: true,
|
2020-01-16 00:48:55 -05:00
|
|
|
},
|
2018-10-15 16:10:18 -04:00
|
|
|
};
|