forked from clair-design/clair
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
28 lines (27 loc) · 957 Bytes
/
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
const { resolveAlias = {} } = require('./package.json')
const aliases = {}
Object.keys(resolveAlias).forEach(key => {
const val = resolveAlias[key]
aliases[`^${key}/(.*)$`] = `<rootDir>/${val}/$1`
})
module.exports = {
bail: true,
collectCoverage: false,
moduleFileExtensions: ['js', 'vue', 'json'],
modulePaths: ['<rootDir>/src', '<rootDir>/node_modules'],
transform: {
'^.+\\.js$': '<rootDir>/node_modules/babel-jest',
'.*\\.(vue)$': '<rootDir>/node_modules/vue-jest'
},
moduleNameMapper: {
'\\.(css|less|scss)$': '<rootDir>/__mocks__/styleMock.js',
...aliases
},
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
testMatch: ['**/__tests__/unit/**/*.spec.js?(x)'],
collectCoverageFrom: ['src/**/*.{js,vue}', '!**/node_modules/**'],
// TODO
// https://docs.codeclimate.com/docs/configuring-test-coverage
coverageReporters: ['html', 'text-summary'],
coverageDirectory: 'coverage/unit'
}