Skip to content

Commit cbaddc3

Browse files
committed
fix: jest 22 did not have default config
1 parent f863ce0 commit cbaddc3

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
const { jestPreset } = require('ts-jest');
2+
13
module.exports = {
2-
preset: 'ts-jest',
4+
...jestPreset,
35
testEnvironment: 'node',
46
globals: { 'ts-jest': { tsConfig: {} } },
57
};

src/utils/create-jest-preset.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
import { defaults } from 'jest-config';
1+
import * as jestConfig from 'jest-config';
22
import { CreateJestPresetOptions } from '../types';
33

4+
// jest 22 doesn't have defaults
5+
const defaults = jestConfig.defaults || {
6+
transform: null,
7+
testMatch: ['**/__tests__/**/*.js?(x)', '**/?(*.)+(spec|test).js?(x)'],
8+
moduleFileExtensions: ['js', 'json', 'jsx', 'node'],
9+
};
10+
411
// TODO: find out if tsconfig that we'll use contains `allowJs`
512
// and change the transform so that it also uses ts-jest for js files
613

0 commit comments

Comments
 (0)