Skip to content

Commit

Permalink
update jest config
Browse files Browse the repository at this point in the history
update jest.config.js

allow superset-generator

temporarily  disallow generator unit test

temporarily remove test dir in plugins

ignore superet-ui-demo

fix dir

try to increase code coverage

prettier

disable generator

update jest

updates

root jest remove generator

add comments

update jest config
  • Loading branch information
zhaoyongjie committed Nov 26, 2021
1 parent 3ea4ff2 commit 196f01a
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions superset-frontend/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,64 @@
* specific language governing permissions and limitations
* under the License.
*/

module.exports = {
testRegex: '(\\/spec|\\/src)\\/.*(_spec|\\.test)\\.(j|t)sx?$',
testRegex: '\\/(spec|src|plugins|packages)\\/.*(_spec|\\.test)\\.[jt]sx?$',
testPathIgnorePatterns: [
'packages\\/generator-superset\\/.*',
'/node_modules/',
],
moduleNameMapper: {
'\\.(css|less|geojson)$': '<rootDir>/spec/__mocks__/mockExportObject.js',
'\\.(gif|ttf|eot|png|jpg)$': '<rootDir>/spec/__mocks__/mockExportString.js',
'\\.svg$': '<rootDir>/spec/__mocks__/svgrMock.tsx',
'^src/(.*)$': '<rootDir>/src/$1',
'^spec/(.*)$': '<rootDir>/spec/$1',
// mapping to souce code instead of lib or esm module
'@superset-ui/(((?!(legacy-preset-chart-deckgl|core/src)).)*)$':
'<rootDir>/node_modules/@superset-ui/$1/src',
'@superset-ui/core/src/(.*)$':
'<rootDir>/node_modules/@superset-ui/core/src/$1',
},
testEnvironment: 'jsdom',
modulePathIgnorePatterns: ['<rootDir>/temporary_superset_ui'],
setupFilesAfterEnv: ['<rootDir>/spec/helpers/setup.ts'],
testURL: 'http://localhost',
collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}', '!**/*.stories.*'],
collectCoverageFrom: [
'src/**/*.{js,jsx,ts,tsx}',
'{packages,plugins}/**/src/**/*.{js,jsx,ts,tsx}',
'!**/*.stories.*',
'!packages/superset-ui-demo/**/*',
],
coverageDirectory: '<rootDir>/coverage/',
coveragePathIgnorePatterns: [
'coverage/',
'node_modules/',
'public/',
'tmp/',
'dist/',
],
coverageReporters: ['lcov', 'json-summary', 'html'],
transform: {
'^.+\\.jsx?$': 'babel-jest',
// ts-jest can't load plugin 'babel-plugin-typescript-to-proptypes'
'reactify\\.tsx$': 'babel-jest',
'^.+\\.tsx?$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
snapshotSerializers: ['@emotion/jest/enzyme-serializer'],
globals: {
'ts-jest': {
babelConfig: true,
// 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,
diagnostics: {
warnOnly: true,
},
},
__DEV__: true,
caches: true,
},
};

0 comments on commit 196f01a

Please sign in to comment.