Commit fedf68e
committed
test(infra): legacy-test-runner supports this.skip() and Promise-returning tests
Two improvements to scripts/legacy-test-runner.js needed for the new
runtime-conditional GHSA tests:
1. `this.skip()` — Mocha exposes runtime-conditional skipping via the
test context. The runner now provides a `skip()` method that throws
a sentinel value, recognised by `testCompleted` and reported as
pending (not failed).
2. Async tests without a `done` callback. Previously the runner only
handled `done`-style async (length > 0) and assumed length-0 tests
were sync. Promise-returning length-0 tests (`async function () {}`)
detached and any rejection became `UnhandledPromiseRejection`. Now
the sync path detects a thenable return and routes the resolution /
rejection through `testCompleted`.1 parent 69fe949 commit fedf68e
1 file changed
Lines changed: 37 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
126 | 129 | | |
127 | 130 | | |
128 | 131 | | |
| |||
136 | 139 | | |
137 | 140 | | |
138 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
139 | 146 | | |
140 | 147 | | |
141 | 148 | | |
142 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
143 | 153 | | |
144 | 154 | | |
145 | 155 | | |
| |||
148 | 158 | | |
149 | 159 | | |
150 | 160 | | |
151 | | - | |
| 161 | + | |
152 | 162 | | |
153 | 163 | | |
154 | 164 | | |
| |||
162 | 172 | | |
163 | 173 | | |
164 | 174 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
170 | 199 | | |
| 200 | + | |
171 | 201 | | |
172 | | - | |
173 | 202 | | |
174 | 203 | | |
175 | 204 | | |
| |||
0 commit comments