(machine: AnyStateMachine)
| 353 | } |
| 354 | |
| 355 | async function runW3TestToCompletion(machine: AnyStateMachine): Promise<void> { |
| 356 | const { resolve, reject, promise } = Promise.withResolvers<void>(); |
| 357 | let nextState: AnyMachineSnapshot; |
| 358 | let prevState: AnyMachineSnapshot; |
| 359 | |
| 360 | const actor = createActor(machine, { |
| 361 | logger: () => void 0 |
| 362 | }); |
| 363 | actor.subscribe({ |
| 364 | next: (state) => { |
| 365 | prevState = nextState; |
| 366 | nextState = state; |
| 367 | }, |
| 368 | complete: () => { |
| 369 | // Add 'final' for test230.txml which does not have a 'pass' state |
| 370 | if (['final', 'pass'].includes(nextState.value as string)) { |
| 371 | resolve(); |
| 372 | } else { |
| 373 | reject( |
| 374 | new Error( |
| 375 | `Reached "fail" state from state ${JSON.stringify( |
| 376 | prevState?.value |
| 377 | )}` |
| 378 | ) |
| 379 | ); |
| 380 | } |
| 381 | } |
| 382 | }); |
| 383 | actor.start(); |
| 384 | return promise; |
| 385 | } |
| 386 | |
| 387 | async function runTestToCompletion( |
| 388 | machine: AnyStateMachine, |
no test coverage detected
searching dependent graphs…