-
Notifications
You must be signed in to change notification settings - Fork 772
/
jest.config.js
45 lines (44 loc) · 1.28 KB
/
jest.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const TEST_TYPE = process.env.TEST_TYPE || 'components'
// const TEST_BUNDLE = TEST_TYPE === 'bundle' ? 'lib/mand-mobile.umd' : ''
module.exports = {
setupFiles: ['jest-canvas-mock', '<rootDir>/test/jest.init.js'],
moduleFileExtensions: [
'js',
'json',
'vue'
],
transform: {
'.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$':
'jest-transform-stub',
'^.+\\.js$': 'babel-jest',
'.*\\.vue$': 'vue-jest',
'^.+\\.svg$': 'jest-svg-sprite-loader'
},
globals: {
'vue-jest': {
babelConfig: {
configFile: '<rootDir>/.babelrc'
}
}
},
modulePaths: [
'<rootDir>/components',
'<rootDir>/node_modules'
],
moduleNameMapper: {
'@examples(.*)': '<rootDir>/examples/$1',
'mand-mobile/lib(.*)': `<rootDir>/${TEST_TYPE}$1`,
'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',
'mand-mobile/components(.*)': `<rootDir>/${TEST_TYPE}$1`
},
snapshotSerializers: [
'jest-serializer-vue'
],
collectCoverage: true,
collectCoverageFrom: [
'components/*/*.{js,vue}'
],
coverageReporters: ['html', 'lcov', 'text-summary'],
coverageDirectory: './test/coverage'
}