diff --git a/src/config/config-set.spec.ts b/src/config/config-set.spec.ts index 89af98723b..6cf028711c 100644 --- a/src/config/config-set.spec.ts +++ b/src/config/config-set.spec.ts @@ -415,7 +415,7 @@ describe('versions', () => { describe('with babel', () => { it('should return correct version map', () => { expect(createConfigSet({ tsJestConfig: { babelConfig: {} } }).versions).toEqual({ - '@babel/core': '-', + '@babel/core': pkgVersion('@babel/core'), 'babel-jest': pkgVersion('babel-jest'), jest: pkgVersion('jest'), 'ts-jest': myModule.version, diff --git a/src/config/create-jest-preset.spec.ts b/src/config/create-jest-preset.spec.ts index bfadbd7e71..3347bb2f3d 100644 --- a/src/config/create-jest-preset.spec.ts +++ b/src/config/create-jest-preset.spec.ts @@ -25,18 +25,6 @@ it('should return correct defaults when allowJs is true', () => { it('should be able to use a base config', () => { expect(createJestPreset(undefined, {})).toMatchInlineSnapshot(` Object { - "moduleFileExtensions": Array [ - "js", - "json", - "jsx", - "ts", - "tsx", - "node", - ], - "testMatch": Array [ - "**/__tests__/**/*.[jt]s?(x)", - "**/?(*.)+(spec|test).[tj]s?(x)", - ], "transform": Object { "^.+\\\\.tsx?$": "ts-jest", }, diff --git a/src/config/create-jest-preset.ts b/src/config/create-jest-preset.ts index 6a1f855f9c..5f82022005 100644 --- a/src/config/create-jest-preset.ts +++ b/src/config/create-jest-preset.ts @@ -12,8 +12,8 @@ const defaults = jestConfigPkg.defaults export interface TsJestPresets { transform: Record - testMatch: string[] - moduleFileExtensions: string[] + testMatch: string[] | undefined + moduleFileExtensions: string[] | undefined } export interface CreateJestPresetOptions { @@ -31,7 +31,7 @@ export function createJestPreset( ...from.transform, [allowJs ? '^.+\\.[tj]sx?$' : '^.+\\.tsx?$']: 'ts-jest', }, - testMatch: from.testMatch || [], - moduleFileExtensions: from.moduleFileExtensions || [], + testMatch: from.testMatch || undefined, + moduleFileExtensions: from.moduleFileExtensions || undefined, } } diff --git a/src/util/importer.spec.ts b/src/util/importer.spec.ts index 1fec177b94..d5d47f55e3 100644 --- a/src/util/importer.spec.ts +++ b/src/util/importer.spec.ts @@ -116,8 +116,8 @@ describe('babelCore', () => { }) it('should fail with correct error message', () => { expect(() => new Importer().babelCore(fakers.importReason())).toThrowErrorMatchingInlineSnapshot(` -"Unable to load any of these modules: \\"@babel/core\\". [[BECAUSE]]. To fix it: - • for Babel 7: \`npm i -D babel-jest @babel/core\` (or \`yarn add --dev babel-jest @babel/core\`)" +"Unable to load the module \\"@babel/core\\". [[BECAUSE]] To fix it: + ↳ install \\"@babel/core\\": \`npm i -D @babel/core\` (or \`yarn add --dev @babel/core\`)" `) }) }) diff --git a/src/util/importer.ts b/src/util/importer.ts index 46aaf804c7..4cbb5dcd95 100644 --- a/src/util/importer.ts +++ b/src/util/importer.ts @@ -47,17 +47,7 @@ export class Importer { } babelCore(why: ImportReasons): TBabelCore { - // the bridge will choose correct babel version - return this._import(why, 'babel-core', { - alternatives: ['@babel/core'], - installTip: [ - // as in https://github.com/facebook/jest/tree/master/packages/babel-jest - { - label: 'for Babel 7', - module: `babel-jest @babel/core`, - }, - ], - }) + return this._import(why, '@babel/core') } typescript(why: ImportReasons, which: string): TTypeScript {