mand-mobile/jest.config.js

43 lines
1.1 KiB
JavaScript
Raw Normal View History

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 = {
setupFiles: ['<rootDir>/test/jest.init.js'],
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`,
'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'
2018-11-26 17:35:31 +08:00
}