2018-05-13 23:11:51 +08:00
|
|
|
const libDir = process.env.LIB_DIR;
|
|
|
|
|
|
|
|
const transformIgnorePatterns = [
|
2019-09-28 19:20:26 +08:00
|
|
|
'/dist/',
|
2020-09-07 18:28:03 +08:00
|
|
|
// Ignore modules without es dir.
|
|
|
|
// Update: @babel/runtime should also be transformed
|
2021-01-24 00:33:38 +08:00
|
|
|
// 'node_modules/(?!.*(@babel|lodash-es))',
|
|
|
|
'node_modules/(?!@ant-design/icons-vue|@ant-design/icons-svg|lodash-es)/',
|
2018-05-13 23:11:51 +08:00
|
|
|
];
|
2020-09-23 17:32:53 +08:00
|
|
|
const testPathIgnorePatterns = ['/node_modules/', 'node'];
|
2021-09-25 16:51:32 +08:00
|
|
|
|
2018-05-13 23:11:51 +08:00
|
|
|
module.exports = {
|
2018-07-27 18:31:34 +08:00
|
|
|
testURL: 'http://localhost/',
|
2018-08-04 17:52:11 +08:00
|
|
|
setupFiles: ['./tests/setup.js'],
|
2020-10-01 20:56:26 +08:00
|
|
|
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json', 'vue', 'md', 'jpg'],
|
2018-08-04 17:52:11 +08:00
|
|
|
modulePathIgnorePatterns: ['/_site/'],
|
2020-09-23 17:32:53 +08:00
|
|
|
testPathIgnorePatterns: testPathIgnorePatterns,
|
2018-05-13 23:11:51 +08:00
|
|
|
transform: {
|
2020-07-25 14:34:22 +08:00
|
|
|
'^.+\\.(vue|md)$': '<rootDir>/node_modules/vue-jest',
|
2019-09-28 19:20:26 +08:00
|
|
|
'^.+\\.(js|jsx)$': '<rootDir>/node_modules/babel-jest',
|
2020-10-01 20:56:26 +08:00
|
|
|
'^.+\\.(ts|tsx)$': '<rootDir>/node_modules/ts-jest',
|
2019-09-28 19:20:26 +08:00
|
|
|
'^.+\\.svg$': '<rootDir>/node_modules/jest-transform-stub',
|
2018-05-13 23:11:51 +08:00
|
|
|
},
|
2019-09-28 19:20:26 +08:00
|
|
|
testRegex: libDir === 'dist' ? 'demo\\.test\\.js$' : '.*\\.test\\.js$',
|
2018-05-13 23:11:51 +08:00
|
|
|
moduleNameMapper: {
|
2019-09-28 19:20:26 +08:00
|
|
|
'^@/(.*)$': '<rootDir>/$1',
|
2020-10-24 14:36:06 +08:00
|
|
|
'ant-design-vue$': '<rootDir>/components/index.ts',
|
2020-03-15 13:12:47 +08:00
|
|
|
'ant-design-vue/es': '<rootDir>/components',
|
2018-05-13 23:11:51 +08:00
|
|
|
},
|
2019-09-28 19:20:26 +08:00
|
|
|
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
|
2018-05-13 23:11:51 +08:00
|
|
|
collectCoverage: process.env.COVERAGE === 'true',
|
|
|
|
collectCoverageFrom: [
|
2019-09-28 19:20:26 +08:00
|
|
|
'components/**/*.{js,jsx,vue}',
|
2018-05-13 23:11:51 +08:00
|
|
|
'!components/*/style/index.{js,jsx}',
|
2018-05-14 10:20:05 +08:00
|
|
|
'!components/style/*.{js,jsx}',
|
|
|
|
'!components/*/locale/*.{js,jsx}',
|
2018-05-13 23:11:51 +08:00
|
|
|
'!components/*/__tests__/**/type.{js,jsx}',
|
2018-05-14 10:20:05 +08:00
|
|
|
'!components/vc-*/**/*',
|
|
|
|
'!components/*/demo/**/*',
|
|
|
|
'!components/_util/**/*',
|
|
|
|
'!components/align/**/*',
|
|
|
|
'!components/trigger/**/*',
|
|
|
|
'!components/style.js',
|
2019-09-28 19:20:26 +08:00
|
|
|
'!**/node_modules/**',
|
2018-05-13 23:11:51 +08:00
|
|
|
],
|
2020-07-25 15:46:49 +08:00
|
|
|
testEnvironment: 'jest-environment-jsdom-fifteen',
|
2019-09-28 19:20:26 +08:00
|
|
|
transformIgnorePatterns,
|
2020-10-01 20:56:26 +08:00
|
|
|
globals: {
|
|
|
|
'ts-jest': {
|
|
|
|
babelConfig: true,
|
|
|
|
},
|
|
|
|
},
|
2018-05-13 23:11:51 +08:00
|
|
|
};
|