-
Notifications
You must be signed in to change notification settings - Fork 13
/
jest.config.js
48 lines (43 loc) · 1.6 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
// This file is needed because it is used by vscode and other tools that
// call `jest` directly. However, unless you are doing anything special
// do not edit this file
//const standard = require('@grafana/toolkit/src/config/jest.plugin.config');
// This process will use the same config that `yarn test` is using
//module.exports = standard.jestConfig();
module.exports = {
preset: 'ts-jest',
verbose: false,
moduleDirectories: [ 'node_modules', 'src' ],
moduleFileExtensions: [ 'ts', 'tsx', 'js', 'jsx', 'json' ],
setupFiles: [
'./node_modules/@grafana/toolkit/src/config/matchMedia.js',
'jest-canvas-mock'
],
globals: {
'ts-jest': {
isolatedModules: true,
tsconfig: './tsconfig.json'
}
},
coverageReporters: [ 'json-summary', 'text', 'lcov' ],
collectCoverageFrom: [ 'src/**/*.{ts,tsx}', '!**/node_modules/**', '!**/vendor/**' ],
reporters: [ 'default', [ 'jest-junit', [Object] ] ],
testEnvironment: 'jsdom',
testMatch: [
'<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}',
'<rootDir>/src/**/*.{spec,test,jest}.{js,jsx,ts,tsx}',
'<rootDir>/spec/**/*.{spec,test,jest}.{js,jsx,ts,tsx}'
],
transform: {
"^.+\\.tsx?$": "ts-jest",
"^.+\\.jsx?$": "babel-jest", // <- also compile js/x files
},
transformIgnorePatterns: [
'[/\\\\\\\\]node_modules[/\\\\\\\\].+\\\\.(js|jsx|ts|tsx)$',
'^.+\\\\.module\\\\.(css|sass|scss)$',
'node_modules/(?!(ol)/)',
],
moduleNameMapper: {
'\\.(css|sass|scss)$': './node_modules/@grafana/toolkit/src/config/styles.mock.js',
}
}