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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom threshold for test time warning/errors #7220

Closed
bowernite opened this issue Oct 19, 2018 · 10 comments 路 Fixed by #9366
Closed

Custom threshold for test time warning/errors #7220

bowernite opened this issue Oct 19, 2018 · 10 comments 路 Fixed by #9366

Comments

@bowernite
Copy link

馃殌 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.

@sylvain-hamel
Copy link

sylvain-hamel commented Feb 26, 2019

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 jest.config.js I'd like an option to change the default

  slowTestDurationThreshold: 30

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

@pingvinen
Copy link

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.

@demisx
Copy link

demisx commented Dec 17, 2019

Same here. My e2e API tests are much slower and need to be able to set a different threshold. Just like with Mocha.

@mmakrzem
Copy link

mmakrzem commented Mar 3, 2020

we would like this feature too!

@joshuapinter
Copy link

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.

@SimenB
Copy link
Member

SimenB commented Jul 28, 2020

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 ProjectConfig.

@joshuapinter
Copy link

@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 ProjectConfig.

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!

@SimenB
Copy link
Member

SimenB commented Jul 28, 2020

I'd forgotten about that PR - let's try to land it!

@SimenB
Copy link
Member

SimenB commented Jul 30, 2020

Released in 26.2.0

@github-actions
Copy link

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants