(expectedLog)
| 287 | } |
| 288 | |
| 289 | export async function waitForDiscrete(expectedLog) { |
| 290 | assertYieldsWereCleared(waitForDiscrete); |
| 291 | |
| 292 | // Create the error object before doing any async work, to get a better |
| 293 | // stack trace. |
| 294 | const error = new Error(); |
| 295 | Error.captureStackTrace(error, waitForDiscrete); |
| 296 | |
| 297 | // Wait until end of current task/microtask. |
| 298 | await waitForMicrotasks(); |
| 299 | |
| 300 | const actualLog = SchedulerMock.unstable_clearLog(); |
| 301 | if (equals(actualLog, expectedLog)) { |
| 302 | return; |
| 303 | } |
| 304 | |
| 305 | error.message = ` |
| 306 | Expected sequence of events did not occur. |
| 307 | |
| 308 | ${diff(expectedLog, actualLog)} |
| 309 | `; |
| 310 | throw error; |
| 311 | } |
| 312 | |
| 313 | export function assertLog(expectedLog) { |
| 314 | const actualLog = SchedulerMock.unstable_clearLog(); |
no test coverage detected