forked from jaredpalmer/tsdx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateJestConfig.ts
More file actions
30 lines (27 loc) · 940 Bytes
/
createJestConfig.ts
File metadata and controls
30 lines (27 loc) · 940 Bytes
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
import { Config } from '@jest/types';
export type JestConfigOptions = Partial<Config.InitialOptions>;
export function createJestConfig(
_: (relativePath: string) => void,
rootDir: string
): JestConfigOptions {
const config: JestConfigOptions = {
transform: {
'.(ts|tsx)$': require.resolve('ts-jest/dist'),
'.(js|jsx)$': require.resolve('babel-jest'), // jest's default
},
transformIgnorePatterns: ['[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
collectCoverageFrom: ['src/**/*.{ts,tsx,js,jsx}'],
testEnvironment: 'jsdom',
testEnvironmentOptions: {
url: 'https://localhost/',
},
testMatch: ['<rootDir>/**/*.(spec|test).{ts,tsx,js,jsx}'],
rootDir,
watchPlugins: [
require.resolve('jest-watch-typeahead/filename'),
require.resolve('jest-watch-typeahead/testname'),
],
};
return config;
}