forked from js-tasks-ru/vue-20230710_mihail64
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
53 lines (41 loc) · 1.65 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
50
51
52
53
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
const config = {
modulePaths: ['utility_modules'],
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json', 'vue'],
transform: {
// Support Vue SFC
'^.+\\.vue$': require.resolve('@vue/vue3-jest'),
// Use babel for ES modules support in Jest and JSX
'^.+\\.[jt]sx?$': require.resolve('babel-jest'),
// Ignore assets
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': require.resolve('jest-transform-stub'),
},
// Dependencies are usually in CommonJS modules
transformIgnorePatterns: ['/node_modules/'],
moduleNameMapper: {
// Support the same @ -> src alias mapping in source code
'^@/(.*)$': '<rootDir>/src/$1',
// Use commonjs version of lodash in tests (migration from previous @vue/cli taskbook...)
'^lodash-es$': 'lodash',
},
testEnvironment: 'jsdom',
// Serializer for Vue snapshots
snapshotSerializers: ['jest-serializer-vue'],
// Add taskbook utilities
setupFilesAfterEnv: ['<rootDir>/utility_modules/taskbook-jest-setup.js'],
testMatch: ['**/[0-9][0-9]*/[0-9][0-9]*/**/__tests__/**/*.(spec|test|student-test).[jt]s?(x)'],
testEnvironmentOptions: {
url: 'https://localhost',
customExportConditions: ['node', 'node-addons'],
},
watchPlugins: [require.resolve('jest-watch-typeahead/filename'), require.resolve('jest-watch-typeahead/testname')],
clearMocks: true,
};
// Legacy config for Taskbook Monitor Generator
if (process.env.TASK_MONITOR) {
Object.assign(config, {
testResultsProcessor: '<rootDir>/utility_modules/taskbook-test-results-processor.js',
reporters: [],
});
}
module.exports = config;