forked from laomao800/vue-listview
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
25 lines (23 loc) · 889 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
const _ = require('lodash')
// 使用随机端口以支持 Jest 多实例运行,如提交前 lint 的时候。
process.env.MOCK_API_PORT = process.env.MOCK_API_PORT || _.random(9000, 9999)
module.exports = {
preset: '@vue/cli-plugin-unit-jest',
setupFiles: ['<rootDir>/tests/unit/setup'],
globalSetup: '<rootDir>/tests/unit/global-setup',
globalTeardown: '<rootDir>/tests/unit/global-teardown',
moduleFileExtensions: ['js', 'json', 'vue'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
'\\.(css|less)$': '<rootDir>/tests/unit/__mocks__/styleMock.js'
},
snapshotSerializers: ['jest-serializer-vue'],
coverageDirectory: '<rootDir>/tests/unit/coverage',
collectCoverageFrom: [
'src/**/*.{js,vue}',
'!src/components/fields/**/*',
'!src/index.js',
'!src/index.component.js'
],
testURL: `http://localhost:${process.env.MOCK_API_PORT}`
}