-
Notifications
You must be signed in to change notification settings - Fork 7
/
jest.config.cjs
37 lines (35 loc) · 1.21 KB
/
jest.config.cjs
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
const path = require('path')
const { TEST_MODE } = process.env
process.env.TZ = 'GMT'
module.exports = {
collectCoverageFrom: [
'<rootDir>/src/**/*.{vue, js}',
'!<rootDir>/src/main.js',
'!<rootDir>/src/services/auth.js',
'!<rootDir>/src/assets/**/*'
],
coverageDirectory: '<rootDir>/coverage',
moduleFileExtensions: ['js', 'vue', 'ts'],
moduleNameMapper: {
'^~/(.*)$': '<rootDir>/$1',
'^.+\\.(css|scss)$': 'babel-jest',
'node_modules/vue/dist/vue.runtime.esm.js': 'node_modules/vue/dist/vue.runtime.js',
'^lodash-es/(.*)$': '<rootDir>/node_modules/lodash/$1'
},
modulePaths: ['<rootDir>'],
rootDir: path.resolve(__dirname, './'),
setupFiles: [`<rootDir>/tests/${TEST_MODE}/config/jest.init.js`],
snapshotSerializers: ['jest-serializer-vue'],
testMatch:
TEST_MODE === 'integration'
? ['**/tests/integration/specs/**/*.spec.js']
: ['**/tests/unit/**/*.spec.js'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(js|jsx|mjs)$': 'babel-jest',
'^.+\\.vue$': '@vue/vue2-jest',
'^.+\\.(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__mocks__/file.js'
},
testEnvironment: 'jest-environment-jsdom'
}