-
Notifications
You must be signed in to change notification settings - Fork 782
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
Provide a public API for manually advancing test execution #1228
Comments
Have you tried using You could use that in // Pause tests for 1 second in between each test
QUnit.module( "my module", function( hooks ) {
hooks.afterEach(function( assert ) {
const advanceTests = assert.async();
setTimeout(advanceTests, 1000);
});
QUnit.test( "some test", function( assert ) {
assert.ok(true);
});
}); |
@platinumazure - Ya, it absolutely allows pausing the test, but there is no way to pause the test after full completion. The goal that @mdebbar is shooting for is to do things use chrome's remote debugging infrastructure to be able to measure memory usage, pending async, pending promises, grab per-test code coverage, etc. This, for example, would allow us to determine if there is leakage between tests. I believe that for this to work we actually need to run after all of the |
This used to be possible via Is the code executing after the tests intended to be async? You could use the If the code execution needs to be async, then perhaps we should evaluate if the reporting callbacks should support returning Promises. As I believe those callbacks cover any remaining "gaps" in the processing timeline. |
Yes, I believe that it needs to be async. I believe that supporting returning promises in the reporting callbacks should probably work fine for this use-case. @mdebbar - Can you confirm? |
What @rwjblue said is correct (thanks for clarifying). We want to be able to do async work between tests. I like the idea of returning promises from QUnit hooks! Simpler than what I originally had in mind, and less likely to be a foot-gun 🙂 Made a quick POC #1230. I appreciate review and guidance on how to write tests for it. Thanks! |
Note that you can return a promise and/or use async functions with These are native to QUnit and not part of the js-reporters spec (which calls these testStart and testEnd instead, and requires them to be synchronous). If you'd want the test to be "fully" finished, I suppose you could also use I'm closing this for now as it's been open for a while without activity. As Trent said on the PR, happy to help think this out further and/or consider new hooks to help make things work more easily. |
Tell us about your runtime:
What are you trying to do?
I'm trying to run the tests and pause after each test. Then I need to manually resume the tests.
I've tried using
QUnit.config.blocking = true;
after a test is finished. It works as expected. The tests are paused. But there's no way to tell QUnit to resume the execution of tests. SettingQUnit.config.blocking
to false doesn't help. Looking at this code it seems like QUnit stops polling for the queue whenblocking
is set to true.What are you proposing?
Expose the
advance
method fromsrc/core/processing-queue.js
as a public API. Maybe add some checks to make sureadvance
is used correctly (e.g. it can't be called when a test is already running).The text was updated successfully, but these errors were encountered: