Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
codetheweb committed Nov 9, 2023
1 parent fdca2ed commit a9eac47
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/api-event-iterator.js
@@ -1,10 +1,12 @@
import {on} from 'node:events';

export async function * asyncEventIteratorFromApi(api) {
for await (const [plan] of on(api, 'run')) {
// TODO: support multiple runs (watch mode)
const {value: plan} = await api.events('run').next();

for await (const stateChange of plan.status.events('stateChange')) {
yield stateChange;

for await (const [stateChange] of on(plan.status, 'stateChange')) {
yield stateChange;
if (stateChange.type === 'end' || stateChange.type === 'interrupt') {
break;
}
}
}

0 comments on commit a9eac47

Please sign in to comment.