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: '/test/jest/coverage', collectCoverageFrom: ['/src/**/*.vue', '/src/**/*.js', '/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: ['/test/jest/__tests__/**/*.(spec|test).js', '/src/**/*.jest.(spec|test).js'], moduleFileExtensions: ['vue', 'js', 'jsx', 'json'], moduleNameMapper: { '^quasar$': 'quasar/dist/quasar.esm.prod.js', '^~/(.*)$': '/$1', '^src/(.*)$': '/src/$1', '^app/(.*)$': '/$1', '^components/(.*)$': '/src/components/$1', '^layouts/(.*)$': '/src/layouts/$1', '^pages/(.*)$': '/src/pages/$1', '^assets/(.*)$': '/src/assets/$1', '^boot/(.*)$': '/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'], };