Commit 27a33d1
committed
Core: Add memory to the
While this is not in any way a documented API, it is quite common for
QUnit runners that are based on Selenium/Webdriver to use HTML scraping
to obtain a simple summary of whether the run passed.
Intruce memory for `runEnd` event so that anything JS-based has a
stable and documented way to obtain the result in a machine-readable
format, without needing to resort to HTML scraping.
One common reason sometimes avoid the event emitter is that, depending
on various circumstances, a custom test runner might end up injecting
code slightly too late, at which point JS code to listen for our event
might not fire, whereas the DOM is still available. This is rare,
but can happen:
* if the file is served as-is.
browserstack-runner and QTap solves this by proxying the HTML file
and inject an inline script to reliable listen early.
Karma solves this by proxing the test framework instead (qunit.js)
and adapting it to include relevant event listeners upfront.
* and, if the browser is driven without early JS control.
When WebDriver v1 is used, something like webdriver "execute" is
not guruanteed to run before DOM-ready or window.onload. If the
Node.js process is slow or far away from the browser (e.g. cloud),
and if the test suite is relatively small/fast, then the injected
code might arrive after the tests have already finished.
grunt-contrib-qunit avoids this by using Puppeteer and
its `Page.evaluateOnNewDocument()` method, to reliably run a script
before any others.
* and, if the test is relatively small/fast.
Example at mauriciolauffer/wdio-qunit-service#13
Solve this once and for all by adding memory to the `runEnd` event.
This allows late event listers to handle the event retroactively.
Cherry-picked from 8f25f26 (3.0.0-dev).runEnd event to allow late event listeners1 parent b13ade0 commit 27a33d1
File tree
4 files changed
+64
-7
lines changed- src
- core
- test/cli/fixtures
4 files changed
+64
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
| 135 | + | |
134 | 136 | | |
135 | 137 | | |
136 | 138 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | | - | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| |||
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
33 | | - | |
| 36 | + | |
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
39 | 46 | | |
40 | 47 | | |
41 | 48 | | |
| |||
57 | 64 | | |
58 | 65 | | |
59 | 66 | | |
60 | | - | |
61 | | - | |
62 | | - | |
| 67 | + | |
63 | 68 | | |
64 | 69 | | |
65 | | - | |
66 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
67 | 76 | | |
68 | 77 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
0 commit comments