-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Change Tests.prototype.all_done
to require either tests or pending remotes
#29970
Conversation
Closing because the amount of test breakage this change introduces (see #29777 (comment)) means it's probably best to try other options to solve #29777. |
Tests.prototype.all_done
Reopening because replacing |
50e0583
to
1d6d1e6
Compare
Tests.prototype.all_done
to require either tests or remote contexts
PR rebased, squashed, renamed and marked as ready for review. |
Tests.prototype.all_done
to require either tests or remote contextsTests.prototype.all_done
to require either tests or pending remotes
1d6d1e6
to
8b3feba
Compare
8b3feba
to
3e2af2c
Compare
I've checked the diffs of this PR with the corresponding commit in master (7df27fb) for Chrome, and every difference seems to be due to a fluke that also affects other recent runs. The one exception is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No substantive concerns, but I think we need a docs update, and either an RFC or some agreement that this is a small enough change to skip an RFC.
I just realized that the change to make |
…remotes `Tests.prototype.all_done` used to treat the presence of at least one test as a necessary condition for all tests to be done. This would be false in cases where an exception is thrown inside the `setup` function, but the code path that runs in that case doesn't use the `all_done()` function. However, if an exception is thrown inside the `setup` function in a worker test, `tests.all_done()` is called in that code path, which results in the completion message from the worker being ignored. This change fixes this by changing the condition to require the presence of either tests or remote contexts. Closes #29777.
af5a0a5
to
ba417e3
Compare
Checked the diffs against master again, and there are no regressions that can't be explained as flaky tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the work on this. I know it's hard to get even a one line change to land :)
Tests.prototype.all_done
used to treat the presence of at least one test as a necessary condition for all tests to be done. This would be false in cases where an exception is thrown inside thesetup
function, but the code path that runs in that case doesn't use theall_done()
function.However, if an exception is thrown inside the
setup
function in a worker test,tests.all_done()
is called in that code path, which results in the completion message from the worker being ignored. This change fixes this by changing the condition to require the presence of either tests or remote contexts.For service worker tests, however, that is not enough, since service worker registration is asynchronous andtests.all_done()
will be called before the SW remote context is set up. This change lets thefetch_tests_from_worker
function take a promise or an async function that returns the worker, and it guarantees that the test won't be considered complete until the promise is resolved. The HTML boilerplate for service worker tests is also changed in turn.Closes #29777.
For historical context, this PR was initially a draft fix for #29777 that removed the condition that
this.tests.length > 0
. This turned out to break many tests (#29777 (comment)), and this PR was repurposed to solve this in a different way.