Skip to content

Commit d703284

Browse files
authored
RFC 141: Change testharness to include late tests (#141)
* Change testharness to include late tests * Fix formatting issues
1 parent a99d688 commit d703284

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# RFC 141: Change testharness to include late tests
2+
3+
## Summary
4+
5+
Currently, "late tests" are
6+
[ignored](https://github.com/web-platform-tests/wpt/blob/c751476c04678faa79e598683f2a6e94d17cf9e0/resources/test/tests/unit/late-test.html#L10-L17).
7+
This RFC proposes that testharness should now include them.
8+
9+
## Details
10+
11+
Conside the following test:
12+
13+
```html
14+
<script>
15+
window.onload = () => {
16+
test((t) => { ... }, 'test 1');
17+
test((t) => { ... }, 'test 2');
18+
test((t) => { ... }, 'test 3');
19+
};
20+
</script>
21+
```
22+
23+
Currently, only test 1 will be run. The issue is that the testharness
24+
immediately adds a window load handler that marks `all_loaded = true`,
25+
and that ends the tests as soon as the first result from the first test
26+
is processed. (The test runner waits for the first test because
27+
`Tests.prototype.all_done()` also waits until `this.tests.length > 0`.)
28+
There were various mitigating corner cases, such as if you started
29+
the list of tests with a `promise_test()`, that would increment a
30+
counter that kept the rest of the tests alive. Etc.
31+
32+
The proposal is to change testharness `window.onload` handler to run
33+
with a `setTimeout(0)` so that all_loaded is only set to true after all of
34+
the tests are loaded by any `window.onload` handler.
35+
36+
## Risks
37+
38+
This change will expose a few tests that should have been failing but were
39+
masked by the lack of test coverage - bugs have been filed for those.
40+
41+
Also, several tests that were working around this via various
42+
means will be cleaned up in the implementation of this RFC.

0 commit comments

Comments
 (0)