You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The common solution to Issue #96 is to use promise_test to execute dependent asynchronous test cases sequentially.
As the Edge team converts tests to TestHarness.js, one pitfall we've discovered is that promise_test() defers invoking its given test func, even if the promise_test is the first in the chain.
For example, this test fails:
var func_is_prompt = true;
promise_test((test) => {
return new Promise((accept, reject) => {
assert_true(func_is_prompt, "Promise was created at the time 'promise_test()' was invoked.");
accept();
});
}, "First 'promise_test()' is not deferred");
func_is_prompt = false;
Because invoking the func given to the first promise_test() is deferred, you cannot reliably have your first promise_test() wait on a global DOM event like window load.
It's relatively simply to change promise_test() to avoid artificially deferring the first func, which I think makes it more useful as a stand-in for sequential_async_test.
(I'll put up a proposed fix for discussion shortly -- thanks to @zhanbox for noticing the race and helping to vet the fix.)
The text was updated successfully, but these errors were encountered:
It's a reasonable "plan B" if, for some reason, we feel the first promise_test must be deferred. Given issue #115, though, I think it's too late to prevent developers from depending on the order of promise_tests in their code.
If we're open to breaking changes, I would suggest that a better way to address issue #115 is to have promise_test return a Promise that is fulfilled when the test completes (pass or fail), and then have developers express their inter-test dependencies explicitly:
Originally posted as w3c/testharness.js#159 by @DLehenbauer on 05 Nov 2015, 20:43 UTC:
The text was updated successfully, but these errors were encountered: