|
| 1 | +const esModules = ['quasar', 'quasar/lang', 'lodash-es'].join('|'); |
| 2 | + |
| 3 | +module.exports = { |
| 4 | + testEnvironment: "jsdom", |
| 5 | + verbose: true, |
| 6 | + globals: { |
| 7 | + __DEV__: true, |
| 8 | + // TODO: Remove if resolved natively |
| 9 | + // See https://github.com/vuejs/vue-jest/issues/175 |
| 10 | + 'vue-jest': { |
| 11 | + pug: { doctype: 'html' }, |
| 12 | + } |
| 13 | + }, |
| 14 | + // noStackTrace: true, |
| 15 | + // bail: true, |
| 16 | + // cache: false, |
| 17 | + // verbose: true, |
| 18 | + // watch: true, |
| 19 | + collectCoverage: false, |
| 20 | + coverageDirectory: '<rootDir>/test/jest/coverage', |
| 21 | + collectCoverageFrom: [ |
| 22 | + '<rootDir>/src/**/*.vue', |
| 23 | + '<rootDir>/src/**/*.js', |
| 24 | + '<rootDir>/src/**/*.jsx', |
| 25 | + ], |
| 26 | + // Needed in JS codebases too because of feature flags |
| 27 | + coveragePathIgnorePatterns: ['/node_modules/', '.d.ts$'], |
| 28 | + coverageThreshold: { |
| 29 | + global: { |
| 30 | + // branches: 50, |
| 31 | + // functions: 50, |
| 32 | + // lines: 50, |
| 33 | + // statements: 50 |
| 34 | + }, |
| 35 | + }, |
| 36 | + testMatch: [ |
| 37 | + '<rootDir>/test/jest/__tests__/**/*.(spec|test).js', |
| 38 | + '<rootDir>/src/**/*.jest.(spec|test).js', |
| 39 | + ], |
| 40 | + moduleFileExtensions: ['vue', 'js', 'jsx', 'json'], |
| 41 | + moduleNameMapper: { |
| 42 | + '^quasar$': 'quasar/dist/quasar.esm.prod.js', |
| 43 | + '^~/(.*)$': '<rootDir>/$1', |
| 44 | + '^src/(.*)$': '<rootDir>/src/$1', |
| 45 | + '^app/(.*)$': '<rootDir>/$1', |
| 46 | + '^components/(.*)$': '<rootDir>/src/components/$1', |
| 47 | + '^layouts/(.*)$': '<rootDir>/src/layouts/$1', |
| 48 | + '^pages/(.*)$': '<rootDir>/src/pages/$1', |
| 49 | + '^assets/(.*)$': '<rootDir>/src/assets/$1', |
| 50 | + '^boot/(.*)$': '<rootDir>/src/boot/$1', |
| 51 | + '.*css$': '@quasar/quasar-app-extension-testing-unit-jest/stub.css', |
| 52 | + }, |
| 53 | + transform: { |
| 54 | + // '.*\\.vue$': 'vue-jest', |
| 55 | + '.*\\.vue$': '@vue/vue3-jest', |
| 56 | + '.*\\.js$': 'babel-jest', |
| 57 | + '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': |
| 58 | + 'jest-transform-stub', |
| 59 | + // use these if NPM is being flaky, care as hosting could interfere with these |
| 60 | + // '.*\\.vue$': '@quasar/quasar-app-extension-testing-unit-jest/node_modules/vue-jest', |
| 61 | + // '.*\\.js$': '@quasar/quasar-app-extension-testing-unit-jest/node_modules/babel-jest' |
| 62 | + }, |
| 63 | + transformIgnorePatterns: [`node_modules/(?!(${esModules}))`], |
| 64 | + snapshotSerializers: ['jest-serializer-vue'], |
| 65 | +}; |
0 commit comments