question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Kill long running test

See original GitHub issue

Hey there, I’m wondering if there is already a built in way or a recommended way to kill any tests that run longer than a particular arbitrary timeout. In my case I’m finding that certain tests are taking an unexpected amount of time to complete and can completely hang my CI environment.

For that reason I’d like to set a maxTestRunTimeout variable to 5 mins and kill any tests with an error if they go longer than that. Is there already a good way to do that? Would maxTestRunTimeout be something that you think should be added as a config option?

Thanks!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
tnrichcommented, Aug 20, 2020

Sounds good @jennifer-shehane , after some playing around it appears that this code should work:

//in support/index.js
let timeoutId
beforeEach(() => {
  timeoutId = setTimeout(() => {
    throw new Error("Test taking tooooo long!")
  }, 60000 * 5); 
})
afterEach(() => {
  clearTimeout(timeoutId)
})
```js
0reactions
jennifer-shehanecommented, Oct 18, 2019

@tnrich There are many events that you can listen to from Cypress that may help you figure out how to workaround what you’re trying to do. https://on.cypress.io/catalog-of-events#Cypress-Events

I don’t think this would qualify as a bug in Cypress or a feature that we intend to add though, so I’m not sure this is the best place for this discussion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to kill a unit test - developer console
Go to force.com setup > Build > Develop > Apex Test Execution > Select your test and click on Abort . It will...
Read more >
NUnit: abort test if it takes too long - Stack Overflow
Ideally it would not only kill the app domain in which the test was running, but also any child processes the test started....
Read more >
Kill long running script, if it crosses the threshold time
Hi, I need a script to kill the process if it running for long time. Inputs for the scripts: 1.test.sh (will be running...
Read more >
Test run state showing as stopping for a long time
Even though i triggered Stop Run for the test. It is still showing state in stopping. Is there a way to kill the...
Read more >
pt-kill — Percona Toolkit Documentation
Print, do not kill, queries running longer than 60s: ... mysql -e "SHOW PROCESSLIST" > proclist.txt pt-kill --test-matching proclist.txt --busy-time 60 -- ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found