(/** @type {(...args: EXPECTED_ANY[]) => EXPECTED_ANY} */ createCompiler)
| 189 | |
| 190 | const monotonicTest = |
| 191 | (/** @type {(...args: EXPECTED_ANY[]) => EXPECTED_ANY} */ createCompiler) => |
| 192 | () => { |
| 193 | /** @type {{ value: number, text: string }[]} */ |
| 194 | const handlerCalls = []; |
| 195 | const compiler = createCompiler({ |
| 196 | handler: (/** @type {number} */ p, /** @type {string[]} */ ...args) => { |
| 197 | handlerCalls.push({ value: p, text: `${p}% ${args.join(class="st">" ")}` }); |
| 198 | } |
| 199 | }); |
| 200 | |
| 201 | return runCompilerAsync(compiler).then(() => { |
| 202 | let lastLine = handlerCalls[0]; |
| 203 | for (const line of handlerCalls) { |
| 204 | if (line.value < lastLine.value) { |
| 205 | throw new Error( |
| 206 | `Progress value is not monotonic increasing:\n${lastLine.text}\n${line.text}` |
| 207 | ); |
| 208 | } |
| 209 | lastLine = line; |
| 210 | } |
| 211 | }); |
| 212 | }; |
| 213 | |
| 214 | it( |
| 215 | class="st">"should have monotonic increasing progress", |
no test coverage detected