diff --git a/package.json b/package.json index 126ec1e3..902c2eb0 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "@commitlint/cli": "^13.1.0", "@commitlint/config-conventional": "^13.1.0", "@commitlint/prompt": "^13.1.0", + "@jest/globals": "^27.4.6", "@types/jest": "^27.4.0", "@typescript-eslint/eslint-plugin": "^5.10.0", "@typescript-eslint/parser": "^5.4.0", diff --git a/src/api/__tests__/test.js b/src/api/__tests__/test.js index 99a6c8a0..6e967c52 100644 --- a/src/api/__tests__/test.js +++ b/src/api/__tests__/test.js @@ -1,11 +1,14 @@ -import * as utilsExports from 'ts-jest/utils' +import * as utilsExports from 'ts-jest' import * as testExports from '../test' // eslint-disable-line import/namespace +const toForwardTsJest = ['pathsToModuleNameMapper', 'createJestPreset'] + describe('re-exporting ts-jest utils', () => { - test.each(Object.entries(utilsExports).filter(([key]) => key !== 'default'))( - 'forwards `%s` export', - (exportName, exportValue) => { - expect(testExports).toHaveProperty(exportName, exportValue) - }, - ) + test.each( + Object.entries(utilsExports).filter(([key]) => + toForwardTsJest.includes(key), + ), + )('forwards `%s` export', (exportName, exportValue) => { + expect(testExports).toHaveProperty(exportName, exportValue) + }) }) diff --git a/src/api/test.js b/src/api/test.js index ef3645dd..8c8ff7b5 100644 --- a/src/api/test.js +++ b/src/api/test.js @@ -1 +1,6 @@ -export * from 'ts-jest/utils' +import {jest} from '@jest/globals' +export {pathsToModuleNameMapper, createJestPreset} from 'ts-jest' + +const {mocked} = jest + +export {mocked}