-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
executable file
·64 lines (63 loc) · 2.13 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
const esModules = ["quasar", "quasar/lang", "lodash-es"].join("|");
module.exports = {
globals: {
__DEV__: true,
// TODO: Remove if resolved natively
// See https://github.com/vuejs/vue-jest/issues/175
"vue-jest": {
pug: { doctype: "html" },
},
},
// Jest assumes we are testing in node environment, specify jsdom environment instead
testEnvironment: "jsdom",
// noStackTrace: true,
// bail: true,
// cache: false,
// verbose: true,
// watch: true,
collectCoverage: false,
coverageDirectory: "<rootDir>/test/jest/coverage",
collectCoverageFrom: [
"<rootDir>/src/**/*.vue",
"<rootDir>/src/**/*.js",
"<rootDir>/src/**/*.jsx",
],
// Needed in JS codebases too because of feature flags
coveragePathIgnorePatterns: ["/node_modules/", ".d.ts$"],
coverageThreshold: {
global: {
// branches: 50,
// functions: 50,
// lines: 50,
// statements: 50
},
},
testMatch: [
"<rootDir>/test/jest/__tests__/**/*.(spec|test).js",
"<rootDir>/src/**/*.jest.(spec|test).js",
],
moduleFileExtensions: ["vue", "js", "jsx", "json"],
moduleNameMapper: {
"^quasar$": "quasar/dist/quasar.esm.prod.js",
"^~/(.*)$": "<rootDir>/$1",
"^src/(.*)$": "<rootDir>/src/$1",
"^app/(.*)$": "<rootDir>/$1",
"^components/(.*)$": "<rootDir>/src/components/$1",
"^layouts/(.*)$": "<rootDir>/src/layouts/$1",
"^pages/(.*)$": "<rootDir>/src/pages/$1",
"^assets/(.*)$": "<rootDir>/src/assets/$1",
"^boot/(.*)$": "<rootDir>/src/boot/$1",
".*css$": "@quasar/quasar-app-extension-testing-unit-jest/stub.css",
},
transform: {
".*\\.vue$": "vue-jest",
".*\\.js$": "babel-jest",
".+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$":
"jest-transform-stub",
// use these if NPM is being flaky, care as hosting could interfere with these
// '.*\\.vue$': '@quasar/quasar-app-extension-testing-unit-jest/node_modules/vue-jest',
// '.*\\.js$': '@quasar/quasar-app-extension-testing-unit-jest/node_modules/babel-jest'
},
transformIgnorePatterns: [`node_modules/(?!(${esModules}))`],
snapshotSerializers: ["jest-serializer-vue"],
};