Commit a44acc4
committed
server: Fix stuck test process when using qtap.run() with file not found
This didn't affect the CLI because:
* that calls the runWaitFor() wrapper, which happened to work because
it rejects after an 'error' event. And, while the main place to
emit the 'error' event is qtap.run() and we don't reach that here,
there was code in server.js emitting this directly.
* it then calls process.exit(1), thus causing the HTTP Server instance
to be force-closed.
In testing, however, while qtap.run() and qtap.runWaitFor() work fine,
the server stays running in the background, and thus the qunit process
hangs forever because server.js emitted the 'error' event, while
qtap.run() is still awaiting browserPromise, and thus we never got
to the "finally", and thus the server still running.
Avoid this kind of out-of-order processing by making sure the only
place to emit the 'error' event is the qtap.run() code, and only after
the 'finally' branch. So instead, pass the error to browser.stop().
That way, browserPromise will settle by throwing, and from there it
will bubble up to qtap.run().1 parent 514229c commit a44acc4
3 files changed
+28
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
225 | | - | |
226 | | - | |
227 | 225 | | |
228 | 226 | | |
229 | 227 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
134 | | - | |
| 133 | + | |
135 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
136 | 146 | | |
137 | 147 | | |
138 | 148 | | |
| |||
144 | 154 | | |
145 | 155 | | |
146 | 156 | | |
147 | | - | |
148 | | - | |
| 157 | + | |
149 | 158 | | |
150 | 159 | | |
151 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | 80 | | |
90 | 81 | | |
91 | 82 | | |
| |||
333 | 324 | | |
334 | 325 | | |
335 | 326 | | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
336 | 341 | | |
337 | 342 | | |
338 | 343 | | |
| |||
0 commit comments