-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
49 lines (48 loc) · 1.43 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
process.env.VUE_CLI_BABEL_TARGET_NODE = 'true';
process.env.VUE_CLI_BABEL_TRANSPILE_MODULES = 'true';
module.exports = {
moduleDirectories: ['node_modules', 'app/javascript'],
moduleFileExtensions: ['js', 'jsx', 'json', 'vue', 'ts', 'tsx'],
automock: false,
resetMocks: true,
transform: {
'^.+\\.vue$': '@vue/vue2-jest',
'.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$':
'jest-transform-stub',
'^.+\\.(js|jsx)?$': 'babel-jest',
},
cacheDirectory: '<rootDir>/.jest-cache',
collectCoverage: true,
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov'],
collectCoverageFrom: [
'**/app/javascript/**/*.js',
'!**/*.stories.js',
'!**/i18n/locale/**/*.js',
],
reporters: ['default'],
transformIgnorePatterns: ['node_modules/*'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/app/javascript/$1',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__mocks__/fileMock.js',
},
roots: ['<rootDir>/app/javascript'],
snapshotSerializers: ['jest-serializer-vue'],
testMatch: [
'**/app/javascript/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)',
],
testEnvironmentOptions: {
url: 'http://localhost/',
},
globals: {
'vue-jest': {
templateCompiler: {
prettify: false,
},
},
},
globalSetup: './jest.setup.js',
testEnvironment: 'jsdom',
setupFiles: ['fake-indexeddb/auto'],
};