/
jest.config.js
71 lines (62 loc) · 2.44 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
// process.env.TZ = "Europe/Berlin";
const deepmerge = require("deepmerge");
// NUXT_REMOVAL we have to remove babel later.
// we have to keep it for now as a migration path for compatibility with legacy js components / tests
// dependencies that can be removed later after fully moving to typescript:
// @vue/cli-plugin-babel, babel-jest
// (do not forget to remove babel.config.js as well)
const defaultPreset = require("@vue/cli-plugin-unit-jest/presets/typescript-and-babel/jest-preset.js");
const config = deepmerge(defaultPreset, {
testMatch: ["**/*.unit.{j,t}s?(x)"],
moduleFileExtensions: ["mjs"],
transform: {
"^.+\\.mjs$": "babel-jest",
},
moduleNameMapper: {
"^axios$": require.resolve("axios"),
"\\.(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
"<rootDir>/tests/test-utils/mediaFileMock.js",
"^@data-(.*)$": "<rootDir>/src/modules/data/$1",
"^@feature-(.*)$": "<rootDir>/src/modules/feature/$1",
"^@page-(.*)$": "<rootDir>/src/modules/page/$1",
"^@ui-(.*)$": "<rootDir>/src/modules/ui/$1",
"^@util-(.*)$": "<rootDir>/src/modules/util/$1",
"^@/(.*)$": "<rootDir>/src/$1",
"^@@/(.*)$": "<rootDir>/$1",
},
setupFiles: ["./tests/setup.js"],
collectCoverageFrom: [
// Include
"<rootDir>/src/components/**/*.{js,ts,vue}",
"<rootDir>/src/modules/**/*.{js,ts,vue}",
"<rootDir>/src/pages/**/*.{js,vue}",
"<rootDir>/src/mixins/**/*.js",
"<rootDir>/src/plugins/**/*.(js|ts)",
"<rootDir>/src/store/**/*.(js|ts)",
"<rootDir>/src/utils/**/*.(js|ts)",
"<rootDir>/src/composables/**/*.(js|ts)",
"<rootDir>/src/layouts/**/*.{js,ts,vue}",
// Exclude
"!<rootDir>/src/components/base/components.js",
"!<rootDir>/src/components/icons/**/*",
"!<rootDir>/src/pages/ActivationCode.page.vue",
"!<rootDir>/src/pages/Imprint.page.vue",
"!<rootDir>/src/pages/LernStoreDetails.page.vue",
"!<rootDir>/src/pages/LernStoreOverview.page.vue",
"!<rootDir>/src/pages/NewsCreate.page.vue",
"!<rootDir>/src/pages/NewsEdit.page.vue",
"!<rootDir>/src/pages/ProxyError.page.vue",
],
globals: {
"vue-jest": {
compilerOptions: {
isCustomElement: (tag) => tag.startsWith("h5p-"),
},
},
},
// maxWorkers: 2, // limited for not taking all workers within of a single github action
});
// we have to overwrite(!) config.transformIgnorePatterns here
// otherwise the rule would be added and have no effect
config.transformIgnorePatterns = ["/node_modules/(?!vuetify)/"];
module.exports = config;