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

fix: make timeouts on a test refer to timeout parameter, rather than jest.setTimeout() #13830

Merged
merged 5 commits into from Feb 23, 2023
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 CHANGELOG.md
Expand Up @@ -11,6 +11,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