2018-12-21 19:46:31 +08:00
|
|
|
const TEST_TYPE = process.env.TEST_TYPE || 'components'
|
|
|
|
// const TEST_BUNDLE = TEST_TYPE === 'bundle' ? 'lib/mand-mobile.umd' : ''
|
|
|
|
|
2018-11-26 17:35:31 +08:00
|
|
|
module.exports = {
|
2019-04-09 17:53:58 +08:00
|
|
|
setupFiles: ['jest-canvas-mock', '<rootDir>/test/jest.init.js'],
|
2018-11-26 17:35:31 +08:00
|
|
|
moduleFileExtensions: [
|
|
|
|
'js',
|
|
|
|
'json',
|
|
|
|
'vue'
|
|
|
|
],
|
|
|
|
transform: {
|
|
|
|
'.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$':
|
|
|
|
'jest-transform-stub',
|
2018-12-09 18:56:41 +08:00
|
|
|
'^.+\\.js$': 'babel-jest',
|
|
|
|
'.*\\.vue$': 'vue-jest',
|
|
|
|
'^.+\\.svg$': 'jest-svg-sprite-loader'
|
2018-11-26 17:35:31 +08:00
|
|
|
},
|
|
|
|
globals: {
|
|
|
|
'vue-jest': {
|
|
|
|
babelConfig: {
|
|
|
|
configFile: '<rootDir>/.babelrc'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
modulePaths: [
|
|
|
|
'<rootDir>/components',
|
|
|
|
'<rootDir>/node_modules'
|
|
|
|
],
|
|
|
|
moduleNameMapper: {
|
2018-12-09 18:56:41 +08:00
|
|
|
'@examples(.*)': '<rootDir>/examples/$1',
|
2018-12-21 19:46:31 +08:00
|
|
|
'mand-mobile/lib(.*)': `<rootDir>/${TEST_TYPE}$1`,
|
2018-12-28 17:13:30 +08:00
|
|
|
'mand-mobile/components/picker/demo/data(.*)': '<rootDir>/components/picker/demo/data/$1',
|
|
|
|
'mand-mobile/components/tab-picker/demo/data(.*)': '<rootDir>/components/tab-picker/demo/data/$1',
|
2018-12-21 19:46:31 +08:00
|
|
|
'mand-mobile/components(.*)': `<rootDir>/${TEST_TYPE}$1`
|
2018-11-26 17:35:31 +08:00
|
|
|
},
|
2018-12-09 18:56:41 +08:00
|
|
|
snapshotSerializers: [
|
|
|
|
'jest-serializer-vue'
|
|
|
|
],
|
2018-12-12 17:34:21 +08:00
|
|
|
collectCoverage: true,
|
2018-12-09 18:56:41 +08:00
|
|
|
collectCoverageFrom: [
|
|
|
|
'components/*/*.{js,vue}'
|
|
|
|
],
|
2018-12-12 17:34:21 +08:00
|
|
|
coverageReporters: ['html', 'lcov', 'text-summary'],
|
|
|
|
coverageDirectory: './test/coverage'
|
2019-04-09 17:53:58 +08:00
|
|
|
}
|