-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Custom threshold for test time warning/errors #7220
Comments
I use jest to drive selenium tests and it reports a test that takes 12 seconds as being slow (the duration is highlighted in red). In this context 12 seconds is fine. In
The value is hardcoded at 5 seconds at the moment. https://github.com/facebook/jest/blob/b4897796bcbcb972234ef699b3e9e0f6b8724132/packages/jest-reporters/src/get_result_header.js#L44-L46 https://stackoverflow.com/questions/54893177/jest-threshold-for-a-test-to-be-reported-as-slow |
I use jest for API tests, where I do actual calls to a running API etc (sometimes simulating entire flows). In that case it would also be helpful to define a custom threshold. |
Same here. My e2e API tests are much slower and need to be able to set a different threshold. Just like with Mocha. |
we would like this feature too! |
Us too. We use Appium for e2e testing and it takes longer than 5 seconds just to spin up the app. If a contributor could comment on if they would be open to a PR that would make this configurable, we would be happy to create a PR for it. Thanks. |
PR welcome! While the threshold works for unit tests, it might not make sense for e.g. integrations tests. Make sure to add it to |
@SimenB Thanks for the response, Simen. I was just about to fork this but it looks like @Draco-Umbratilis has already done a PR and updated it to add it to Can you guys take a look at that and see what, if anything, needs to be done before it's merged in? No sense in reinventing the wheel here. Thanks! |
I'd forgotten about that PR - let's try to land it! |
Released in 26.2.0 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🚀 Feature Proposal
Provide a custom way to set the thresholds for when the time in the logged output is highlighted (red, for example, when a suite/test takes a long time).
Even a way to turn these warning colors off would be useful.
Motivation
Some tests are known to take a long time (e.g. spinning up databases, testing database operations), and it'd be nice to not be warned with those colors when running tests.
Example
In the config, some options like
timeWarningThreshold
where the user could specify the threshold themselves. Or,disabledTimeWarnings
to turn them off completely.The text was updated successfully, but these errors were encountered: