app/frontend/jest.config.js
module.exports = {
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: ['src/**/*.{js,vue}', '!src/main.js', '!src/plugins/*.*'],
moduleFileExtensions: ['js', 'json', 'vue', 'jsx'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1'
},
preset: '@vue/cli-plugin-unit-jest',
setupFiles: ['<rootDir>/tests/unit/globalSetup.js'],
snapshotSerializers: ['jest-serializer-vue'],
testMatch: [
'**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)'
],
testURL: 'http://localhost/',
transform: {
'.*\\.(vue)$': 'vue-jest',
'^.+\\.vue$': 'vue-jest',
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$':
'jest-transform-stub',
'^.+\\.jsx?$': 'babel-jest'
},
transformIgnorePatterns: ['/node_modules/'],
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname'
]
};