Skip to content
This repository has been archived by the owner on Sep 19, 2018. It is now read-only.

Require "thenable" for promise_test #252

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jugglinmike
Copy link
Contributor

@jugglinmike jugglinmike commented Mar 27, 2017

The promise_test function is intended to run an asynchronous test, interpreting its status via a "thenable" object provided via return value. Previously, it would accept functions that did not provide such a value, and this meant that tests could fail silently. Because there is no use case for using promise_test in this way, the condition always reflects a programming error.

Update the harness to explicitly fail the test whenever this occurs, prompting contributors to correct their usage prior to submitting the test.

@jgraham This is in response to web-platform-tests/wpt#5228 . It's difficult to say how many tests this change might effect; would you mind vetting it against WPT using Mozilla's testing infrastructure, like we did with #240 ?


This change is Reviewable

The `promise_test` function is intended to run an asynchronous test,
interpreting its status via a "thenable" object provided via return
value. Previously, it would accept functions that did not provide such a
value, and this meant that tests could fail silently. Because there is
no use case for using `promise_test` in this way, the condition always
reflects a programming error.

Update the harness to explicitly fail the test whenever this occurs,
prompting contributors to correct their usage prior to submitting the
test.
@jugglinmike
Copy link
Contributor Author

This may not be a strong enough indicator. The existing code detects the bug I referenced above, but I suspect that test failures were expected when the patch was submitted, so it may not have been evident that the tests were failing for the wrong reason. @jgraham: do you think we should fail the test suite itself in this case?

@jgraham
Copy link
Member

jgraham commented Mar 28, 2017

Yes, I think it makes sense to move this logic outside the test.step so that the overall harness status is affected rather than a specific test status.

@jugglinmike
Copy link
Contributor Author

Okay @jgraham, I've updated this to fail the harness. This version still causes
the test to fail since that may help test authors locate the source of the
problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants