Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(utils): deprecate mocked util function #3102

Merged
merged 1 commit into from Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Expand Up @@ -78,6 +78,7 @@ jobs:
run: npm run test -- --coverage && cat ./coverage/lcov.info
env:
CI: true
DISABLE_MOCKED_WARNING: true
- name: Coveralls parallel
uses: coverallsapp/github-action@master
with:
Expand Down
9 changes: 9 additions & 0 deletions src/utils/testing.ts
@@ -1,3 +1,12 @@
if (!process.env.DISABLE_MOCKED_WARNING) {
console.warn(
'\n`mocked` util function is now deprecated and has been moved to Jest repository,' +
' see https://github.com/facebook/jest/pull/12089. In `ts-jest` v28.0.0, `mocked` function will be completely removed.' +
' Users are encouraged to use to Jest v27.4.0 or above to have `mocked` function available from `jest-mock`. ' +
'One can disable this warning by setting environment variable process.env.DISABLE_MOCKED_WARNING=true\n',
)
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type MockableFunction = (...args: any[]) => any
export type MethodKeysOf<T> = { [K in keyof T]: T[K] extends MockableFunction ? K : never }[keyof T]
Expand Down