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/',
|
|
|
|
'node_modules/[^/]+?/(?!(es|node_modules)/)', // Ignore modules without es dir
|
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'],
|
2019-09-28 19:20:26 +08:00
|
|
|
moduleFileExtensions: ['js', 'jsx', 'json', 'vue', 'md', 'jpg'],
|
2018-08-04 17:52:11 +08:00
|
|
|
modulePathIgnorePatterns: ['/_site/'],
|
2019-09-28 19:20:26 +08:00
|
|
|
testPathIgnorePatterns: ['/node_modules/', 'node'],
|
2018-05-13 23:11:51 +08:00
|
|
|
transform: {
|
2019-09-28 19:20:26 +08:00
|
|
|
'.*\\.(vue|md)$': '<rootDir>/node_modules/vue-jest',
|
|
|
|
'^.+\\.(js|jsx)$': '<rootDir>/node_modules/babel-jest',
|
|
|
|
'^.+\\.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-03-15 13:12:47 +08:00
|
|
|
'ant-design-vue$': '<rootDir>/components/index.js',
|
|
|
|
'ant-design-vue/es': '<rootDir>/components',
|
2020-06-11 15:58:41 +08:00
|
|
|
// '^vue$': 'vue/dist/vue.global.js',
|
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
|
|
|
],
|
2019-09-28 19:20:26 +08:00
|
|
|
transformIgnorePatterns,
|
2018-05-13 23:11:51 +08:00
|
|
|
};
|