-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathjest.config.js
30 lines (24 loc) · 1000 Bytes
/
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
// Test configuration
// See https://jestjs.io/docs/configuration#testenvironment-string
const config = {
preset: 'ts-jest',
// File extensions for imports, in order of precedence:
moduleFileExtensions: ['ts', 'js'],
testPathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/node_modules/'],
// Mocks.
// See https://jestjs.io/docs/webpack#handling-static-assets
moduleNameMapper: {
// Webpack/ESBuild allows importing CSS files. Mock it.
'\\.(css|lessc)': '<rootDir>/testing/mocks/styleMock.js',
'@melloware/coloris': '<rootDir>/testing/mocks/coloris.ts',
},
testEnvironment: 'jsdom',
testEnvironmentOptions: {
// Prevents scripts from running within iframes (including sandboxed iframes)
// which prevents "Error: The SVG sandbox is broken! Please double-check the sandboxing setting."
// from being repeatedly logged to the console during testing.
runScripts: 'outside-only',
},
setupFilesAfterEnv: ['<rootDir>/testing/beforeEachFile.ts'],
};
module.exports = config;