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.
How can I configure the threshold to 30 seconds?
Configure the slowTestThreshold
in seconds, as shown in the docs
// jest.config.js
module.exports = {
/* ... */
slowTestThreshold: 30,
/* ... */
}
Jest
is currently hard-coded to consider any test running over 5 seconds as long:
if (runTime !== null && runTime > 5) {
testDetail.push(LONG_TEST_COLOR(runTime + 's'));
}
Looks like you would need to fork the repo or submit a PR if you wanted to change that.
Jest allows configuration property slowTestThreshold
which you can set in milliseconds.
Jest allows configuration property slowTestThreshold
which you can set in seconds.
example jest.config.js
module.exports = async () => {
return {
slowTestThreshold: 30
};
};
this will show error if tests run for more than 30 seconds
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With