Skip to content

Commit

Permalink
fix: make timeouts on a test refer to timeout parameter, rather than …
Browse files Browse the repository at this point in the history
…jest.setTimeout() (#13830)
  • Loading branch information
mikemaccana committed Feb 23, 2023
1 parent 47b37f8 commit 302d783
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion e2e/__tests__/failures.test.ts
Expand Up @@ -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\).*/, '<REPLACED>')
.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..*/,
'<REPLACED>',
)
.replace(/.*Timeout - Async callback was not.*/, '<REPLACED>');

expect(result).toMatchSnapshot();
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-circus/src/utils.ts
Expand Up @@ -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.
Expand Down

0 comments on commit 302d783

Please sign in to comment.