-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Pausing test #6855
Comments
Setting the timeout programatically from within a test will stop working in the future, you'll need to supply the argument to the test function (or set it in a hook). You can then use e.g. https://github.com/sindresorhus/delay to wait for some time. test("this needs to wait", async () => {
// Do some stuff
await delay(1000000);
// Do some more stuff
}, 1000000); I'm not sure if it's possible to be more clever, from core or the outside. Maybe by applying some fancy babel transforms, but that might be excessive (and I don't know what they would do). |
@SimenB why are we getting rid of setting the timeout programmatically? :) |
Sounds even better 🙂 I thought we landed on that changing the timeout from within a test was weird and confusing, but I suppose we could also make it work properly 🙂 |
That said, you don't really need to change the timeout. There's no real way to interrupt the execution of a JS program, so as long as you set a breakpoint you'll be able to inspect the test any way you want (the test will timeout, but that only happens afterwards, the code still runs) |
I cannot set a breakpoint without being in debug mode. Actually setting the timeout in the test is inconsistent, it works when a timeout is not set but it doesn't if a timeout is set in test / it. |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 14 days. |
This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
I am the creator and the maintainer of Jest Puppeteer. It brings integration testing into the Jest world.
Writing integration test is not very easy, frequently you have to pause your test to figure out what's going on in the browser. For this specific use case I added a debug mode to Jest Puppeteer. It is simple, you add :
await jestPuppeteer.debug()
and your test wait at this line until you press a key.Actually the debug mode implementation is very hacky, I set Jest timeout to 4 days. But unfortunately the test has already start and it does not work well.
Is it possible to suspend the execution of a test in Jest? I am looking forward to find a solution to make it work! Thanks!
The text was updated successfully, but these errors were encountered: