Skip to content

Commit

Permalink
fix(api/test): forward ts-jest utils from ts-jest, mocked from Jest
Browse files Browse the repository at this point in the history
  • Loading branch information
jrolfs committed Jan 29, 2022
1 parent 4f562a4 commit 1ba493e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -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",
Expand Down
17 changes: 10 additions & 7 deletions 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)
})
})
7 changes: 6 additions & 1 deletion 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}

0 comments on commit 1ba493e

Please sign in to comment.