2022-03-11 10:25:30 +00:00
|
|
|
const esModules = ['quasar', 'quasar/lang', 'lodash-es'].join('|');
|
|
|
|
|
2022-02-24 08:23:59 +00:00
|
|
|
module.exports = {
|
2022-03-11 10:36:40 +00:00
|
|
|
globals: {
|
|
|
|
__DEV__: true,
|
|
|
|
// TODO: Remove if resolved natively
|
|
|
|
// See https://github.com/vuejs/vue-jest/issues/175
|
|
|
|
'vue-jest': {
|
|
|
|
pug: { doctype: 'html' },
|
|
|
|
},
|
2022-02-25 12:12:14 +00:00
|
|
|
},
|
2022-03-24 13:57:11 +00:00
|
|
|
// Jest assumes we are testing in node environment, specify jsdom environment instead
|
|
|
|
testEnvironment: 'jsdom',
|
2022-03-11 10:36:40 +00:00
|
|
|
// noStackTrace: true,
|
|
|
|
// bail: true,
|
|
|
|
// cache: false,
|
|
|
|
// verbose: true,
|
|
|
|
// watch: true,
|
2022-03-29 10:53:02 +00:00
|
|
|
reporters: ['default', 'jest-junit'],
|
2022-03-11 10:36:40 +00:00
|
|
|
collectCoverage: false,
|
|
|
|
coverageDirectory: '<rootDir>/test/jest/coverage',
|
2022-03-24 13:57:11 +00:00
|
|
|
collectCoverageFrom: ['<rootDir>/src/**/*.vue', '<rootDir>/src/**/*.js', '<rootDir>/src/**/*.jsx'],
|
|
|
|
// Needed in JS codebases too because of feature flags
|
2022-03-11 10:36:40 +00:00
|
|
|
coveragePathIgnorePatterns: ['/node_modules/', '.d.ts$'],
|
|
|
|
coverageThreshold: {
|
|
|
|
global: {
|
|
|
|
// branches: 50,
|
|
|
|
// functions: 50,
|
|
|
|
// lines: 50,
|
|
|
|
// statements: 50
|
|
|
|
},
|
2022-03-11 10:25:30 +00:00
|
|
|
},
|
2022-03-25 09:44:11 +00:00
|
|
|
testMatch: ['<rootDir>/src/**/__tests__/*.(spec|test).+(ts|js)?(x)'],
|
2022-03-24 13:57:11 +00:00
|
|
|
moduleFileExtensions: ['vue', 'js', 'jsx', 'json'],
|
2022-03-11 10:36:40 +00:00
|
|
|
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',
|
2022-03-11 10:25:30 +00:00
|
|
|
},
|
2022-03-11 10:36:40 +00:00
|
|
|
transform: {
|
|
|
|
'.*\\.vue$': 'vue-jest',
|
2022-03-24 13:57:11 +00:00
|
|
|
'.*\\.js$': 'babel-jest',
|
2022-03-14 10:31:37 +00:00
|
|
|
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
|
2022-03-24 13:57:11 +00:00
|
|
|
// 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'
|
2022-03-11 10:36:40 +00:00
|
|
|
},
|
|
|
|
transformIgnorePatterns: [`node_modules/(?!(${esModules}))`],
|
2022-03-24 13:57:11 +00:00
|
|
|
snapshotSerializers: ['jest-serializer-vue'],
|
2022-02-24 08:23:59 +00:00
|
|
|
};
|