mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-28 04:39:07 -10:00
Automatic update from web-platform-tests[testharness.js] Reject non-thenable values (#12898) Previously, any test defined via the `promise_test` API would fail immediately if its body returned the value `undefined`. The test would *not* fail if it returned any other value. Because the motivation for using `promise_test` is to track resolution with a "thenable" value (i.e. an object with a "then" method), this was overly permissive and allowed contributors to write tests which spuriously passed [1]. Update testharness.js to enforce more stringent criteria on the value return by `promise_test` bodies: that it is a "thenable" value. This change is incompatible with an exiting functional test, but it does not effect any tests in WPT (as verified by a survey using both the Chrome and Firefox browsers). Update the functional test accordingly. [1] cca6b6845678d9b5f792b886f3f7045d1d2cf0a7 -- wpt-commits: 86579034357501943927f3dc4abf75d76c477383 wpt-pr: 12898
Resources
testharness.js
testharness.js is a framework for writing low-level tests of
browser functionality in javascript. It provides a convenient API for
making assertions and is intended to work for both simple synchronous
tests, and tests of asynchronous behaviour.
Getting started
To use testharness.js you must include two scripts, in the order given:
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
Full documentation
For detailed API documentation please visit https://web-platform-tests.org/writing-tests/testharness-api.html.
Tutorials
You can also read a tutorial on Using testharness.js.