diff --git a/CHANGELOG.md b/CHANGELOG.md index a7c657d58af8..ca0f7ac92736 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ ### Fixes - `[jest-circus]` Send test case results for `todo` tests ([#13915](https://github.com/facebook/jest/pull/13915)) +- `[jest-circus]` Update message printed on test timeout ([#13830](https://github.com/facebook/jest/pull/13830)) ### Chore & Maintenance diff --git a/e2e/__tests__/failures.test.ts b/e2e/__tests__/failures.test.ts index f9b61caeeaea..ca4c1cdd12c0 100644 --- a/e2e/__tests__/failures.test.ts +++ b/e2e/__tests__/failures.test.ts @@ -64,7 +64,10 @@ test('works with async failures', () => { // Remove replacements when jasmine is gone const result = normalizeDots(rest) .replace(/.*thrown:.*\n/, '') - .replace(/.*Use jest\.setTimeout\(newTimeout\).*/, '') + .replace( + /.*Add a timeout value to this test to increase the timeout, if this is a long-running test. See https:\/\/jestjs.io\/docs\/api#testname-fn-timeout..*/, + '', + ) .replace(/.*Timeout - Async callback was not.*/, ''); expect(result).toMatchSnapshot(); diff --git a/packages/jest-circus/src/utils.ts b/packages/jest-circus/src/utils.ts index c8f25ce33db9..f59fd2886b80 100644 --- a/packages/jest-circus/src/utils.ts +++ b/packages/jest-circus/src/utils.ts @@ -180,7 +180,7 @@ const _makeTimeoutMessage = ( isHook ? 'hook' : 'test' }${ takesDoneCallback && ' while waiting for `done()` to be called' - }.\nUse jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test.`; + }.\nAdd a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout.`; // Global values can be overwritten by mocks or tests. We'll capture // the original values in the variables before we require any files.