mirror of
https://github.com/servo/servo.git
synced 2025-08-08 15:05:35 +01:00
Update web-platform-tests to revision 4af6af604800559d2c58cf3561621ae43e28aaa8
This commit is contained in:
parent
19c1f72eb2
commit
1a24e35f18
150 changed files with 3701 additions and 419 deletions
|
@ -175,7 +175,7 @@ see the [lint-tool documentation][lint-tool].
|
|||
|
||||
But in the unusual case of error reports for things essential to a certain
|
||||
test or that for other exceptional reasons shouldn't prevent a merge of a
|
||||
test, update and commit the `lint.whitelist` file in the web-platform-tests
|
||||
test, update and commit the `lint.ignorelist` file in the web-platform-tests
|
||||
root directory to suppress the error reports. For details on doing that,
|
||||
see the [lint-tool documentation][lint-tool].
|
||||
|
||||
|
|
|
@ -11,16 +11,15 @@ web-platform-tests working directory like this:
|
|||
The lint tool is also run automatically for every submitted pull request,
|
||||
and reviewers will not merge branches with tests that have lint errors, so
|
||||
you must either [fix all lint errors](#fixing-lint-errors), or you must
|
||||
[whitelist test files](#updating-the-whitelist) to suppress the errors.
|
||||
[add an exception](#updating-the-ignorelist) to suppress the errors.
|
||||
|
||||
## Fixing lint errors
|
||||
|
||||
You must fix any errors the lint tool reports, unless an error is for
|
||||
something essential to a certain test or that for some other
|
||||
exceptional reason shouldn't prevent the test from being merged; in
|
||||
those cases you can [whitelist test files](#updating-the-whitelist)
|
||||
to suppress the errors. In all other cases, follow the instructions
|
||||
below to fix all errors reported.
|
||||
You must fix any errors the lint tool reports, unless an error is for something
|
||||
essential to a certain test or that for some other exceptional reason shouldn't
|
||||
prevent the test from being merged; in those cases you can [add an
|
||||
exception](#updating-the-ignorelist) to suppress the errors. In all other
|
||||
cases, follow the instructions below to fix all errors reported.
|
||||
|
||||
<!--
|
||||
This listing is automatically generated from the linting tool's Python source
|
||||
|
@ -31,32 +30,30 @@ below to fix all errors reported.
|
|||
.. wpt-lint-rules:: tools.lint.rules
|
||||
```
|
||||
|
||||
## Updating the whitelist
|
||||
## Updating the ignorelist
|
||||
|
||||
Normally you must [fix all lint errors](#fixing-lint-errors). But in the
|
||||
unusual case of error reports for things essential to certain tests or that
|
||||
for other exceptional reasons shouldn't prevent a merge of a test, you can
|
||||
update and commit the `lint.whitelist` file in the web-platform-tests root
|
||||
update and commit the `lint.ignorelist` file in the web-platform-tests root
|
||||
directory to suppress errors the lint tool would report for a test file.
|
||||
|
||||
To add a test file or directory to the whitelist, use the following format:
|
||||
To add a test file or directory to the list, use the following format:
|
||||
|
||||
```
|
||||
ERROR TYPE:file/name/pattern
|
||||
```
|
||||
|
||||
For example, to whitelist the file `example/file.html` such that all
|
||||
`TRAILING WHITESPACE` errors the lint tool would report for it are
|
||||
suppressed, add the following line to the `lint.whitelist` file:
|
||||
For example, to ignore all `TRAILING WHITESPACE` errors in the file
|
||||
`example/file.html`, add the following line to the `lint.ignorelist` file:
|
||||
|
||||
```
|
||||
TRAILING WHITESPACE:example/file.html
|
||||
```
|
||||
|
||||
To whitelist an entire directory rather than just one file, use the `*`
|
||||
wildcard. For example, to whitelist the `example` directory such that all
|
||||
`TRAILING WHITESPACE` errors the lint tool would report for any files in it
|
||||
are suppressed, add the following line to the `lint.whitelist` file:
|
||||
To ignore errors for an entire directory rather than just one file, use the `*`
|
||||
wildcard. For example, to ignore all `TRAILING WHITESPACE` errors in the
|
||||
`example` directory, add the following line to the `lint.ignorelist` file:
|
||||
|
||||
```
|
||||
TRAILING WHITESPACE:example/*
|
||||
|
@ -67,15 +64,14 @@ use
|
|||
[shell-style wildcards](https://docs.python.org/2/library/fnmatch.html) to
|
||||
express other filename patterns or directory-name patterns.
|
||||
|
||||
Finally, to whitelist just one line in a file, use the following format:
|
||||
Finally, to ignore just one line in a file, use the following format:
|
||||
|
||||
```
|
||||
ERROR TYPE:file/name/pattern:line_number
|
||||
```
|
||||
|
||||
For example, to whitelist just line 128 of the file `example/file.html`
|
||||
such that any `TRAILING WHITESPACE` error the lint tool would report for
|
||||
that line is suppressed, add the following to the `lint.whitelist` file:
|
||||
For example, to ignore the `TRAILING WHITESPACE` error for just line 128 of the
|
||||
file `example/file.html`, add the following to the `lint.ignorelist` file:
|
||||
|
||||
```
|
||||
TRAILING WHITESPACE:example/file.html:128
|
||||
|
|
|
@ -392,8 +392,47 @@ timeout to use.
|
|||
|
||||
In other cases it may be necessary to use a timeout (e.g., for a test
|
||||
that only passes if some event is *not* fired). In this case it is
|
||||
*not* permitted to use the standard `setTimeout` function. Instead one
|
||||
must use the `step_timeout` function:
|
||||
*not* permitted to use the standard `setTimeout` function.
|
||||
|
||||
Instead, one of these functions can be used:
|
||||
|
||||
* `step_wait` (returns a promise)
|
||||
* `step_wait_func` & `step_wait_func_done`
|
||||
* As a last resort, `step_timeout`
|
||||
|
||||
### `step_wait`, `step_wait_func`, and `step_wait_func_done` ###
|
||||
|
||||
These functions are preferred over `step_timeout` as they end when a condition or a timeout is reached, rather than just a timeout. This allows for setting a longer timeout while shortening the runtime of tests on faster machines.
|
||||
|
||||
`step_wait(cond, description, timeout=3000, interval=100)` is useful inside `promise_test`, e.g.:
|
||||
|
||||
```js
|
||||
promise_test(t => {
|
||||
// …
|
||||
await t.step_wait(() => frame.contentDocument === null, "Frame navigated to a cross-origin document");
|
||||
// …
|
||||
}, "");
|
||||
```
|
||||
|
||||
`step_wait_func(cond, func, description, timeout=3000, interval=100)` & `step_wait_func(cond, func, description, timeout=3000, interval=100)` are useful inside `async_test`:
|
||||
|
||||
```js
|
||||
async_test(t => {
|
||||
const popup = window.open("resources/coop-coep.py?coop=same-origin&coep=&navigate=about:blank");
|
||||
t.add_cleanup(() => popup.close());
|
||||
assert_equals(window, popup.opener);
|
||||
|
||||
popup.onload = t.step_func(() => {
|
||||
assert_true(popup.location.href.endsWith("&navigate=about:blank"));
|
||||
// Use step_wait_func_done as about:blank cannot message back.
|
||||
t.step_wait_func_done(() => popup.location.href === "about:blank");
|
||||
});
|
||||
}, "Navigating a popup to about:blank");
|
||||
```
|
||||
|
||||
### `step_timeout` ###
|
||||
|
||||
As a last resort one can use the `step_timeout` function:
|
||||
|
||||
```js
|
||||
async_test(function(t) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue