Skip to content

Commit

Permalink
fix: jest 22 did not have default config
Browse files Browse the repository at this point in the history
  • Loading branch information
huafu committed Aug 13, 2018
1 parent f863ce0 commit cbaddc3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion e2e/__templates__/with-jest-22/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const { jestPreset } = require('ts-jest');

module.exports = {
preset: 'ts-jest',
...jestPreset,
testEnvironment: 'node',
globals: { 'ts-jest': { tsConfig: {} } },
};
9 changes: 8 additions & 1 deletion src/utils/create-jest-preset.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { defaults } from 'jest-config';
import * as jestConfig from 'jest-config';
import { CreateJestPresetOptions } from '../types';

// jest 22 doesn't have defaults
const defaults = jestConfig.defaults || {
transform: null,
testMatch: ['**/__tests__/**/*.js?(x)', '**/?(*.)+(spec|test).js?(x)'],
moduleFileExtensions: ['js', 'json', 'jsx', 'node'],
};

// TODO: find out if tsconfig that we'll use contains `allowJs`
// and change the transform so that it also uses ts-jest for js files

Expand Down

0 comments on commit cbaddc3

Please sign in to comment.