forked from karrot-dev/karrot-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
executable file
·72 lines (71 loc) · 2.06 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
const esModules = ['quasar', 'quasar/lang', 'lodash-es', 'leaflet'].join('|')
module.exports = {
roots: [
'<rootDir>/src/',
'<rootDir>/test/',
],
globals: {
__DEV__: true,
},
testEnvironment: 'jsdom',
testEnvironmentOptions: {
customExportConditions: ['node', 'node-addons'],
pretendToBeVisual: true,
},
// do not collect coverage by default, can always pass the --coverage command line option
collectCoverage: false,
collectCoverageFrom: [
'<rootDir>/src/**/*.{js,vue}',
// exclude old files, TODO remove
'!**/*.story.js',
],
coverageDirectory: './coverage/',
coverageProvider: 'v8',
coverageReporters: [
'json',
'lcov',
'text',
],
// Needed in JS codebases too because of feature flags
coveragePathIgnorePatterns: [
'/node_modules/',
'.d.ts$',
'.story.js$',
'.spec.js$',
],
testMatch: [
'<rootDir>/src/**/*.spec.js',
'<rootDir>/test/**/*.spec.js',
],
moduleDirectories: [
'node_modules',
'<rootDir>/src',
],
moduleFileExtensions: ['vue', 'js', 'json'],
moduleNameMapper: {
'^quasar$': 'quasar/dist/quasar.esm.prod.js',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)(\\?.+)?$': '<rootDir>/test/fileMock.js',
'\\.(css|less|styl|stylus|sass|scss)$': '<rootDir>/test/styleMock.js',
'@/(.*)$': '<rootDir>/src/$1',
'>/(.*)$': '<rootDir>/test/$1',
},
transform: {
'.*\\.vue$': '@vue/vue3-jest',
'.*\\.m?js$': 'babel-jest',
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)(\\?.+)?$': 'jest-transform-stub',
},
transformIgnorePatterns: [`node_modules/(?!(${esModules}))`],
snapshotSerializers: ['jest-serializer-vue'],
setupFiles: [
'<rootDir>/test/setup/env.js',
'<rootDir>/test/setup/unhandledPromiseRejectionHandler.js',
'<rootDir>/test/setup/mockRandom.js',
'<rootDir>/test/setup/mockScroll.js',
'<rootDir>/test/setup/mockUserAgent.js',
'<rootDir>/test/setup/mockLocation.js',
'jest-canvas-mock',
],
setupFilesAfterEnv: [
'<rootDir>/test/setup/afterEnv.js',
],
}