Skip to content

Commit

Permalink
refactor(utils): deprecate mocked util function (#3102)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnpnl authored Nov 30, 2021
1 parent e1bca72 commit 55e69f1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 55e69f1

Please sign in to comment.