diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6fad5ff93b..465521e6f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/src/utils/testing.ts b/src/utils/testing.ts index 5b6d7a0f8f..a9783348e8 100644 --- a/src/utils/testing.ts +++ b/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 = { [K in keyof T]: T[K] extends MockableFunction ? K : never }[keyof T]