Skip to content

Commit

Permalink
fix(TestScheduler): restore run changes upon error
Browse files Browse the repository at this point in the history
  • Loading branch information
cartant committed May 17, 2018
1 parent 4b68933 commit 27cb9b6
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/internal/testing/TestScheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,14 +378,15 @@ export class TestScheduler extends VirtualTimeScheduler {
expectObservable: this.expectObservable.bind(this),
expectSubscriptions: this.expectSubscriptions.bind(this),
};
const ret = callback(helpers);
this.flush();

TestScheduler.frameTimeFactor = prevFrameTimeFactor;
this.maxFrames = prevMaxFrames;
this.runMode = false;
AsyncScheduler.delegate = undefined;

return ret;
try {
const ret = callback(helpers);
this.flush();
return ret;
} finally {
TestScheduler.frameTimeFactor = prevFrameTimeFactor;
this.maxFrames = prevMaxFrames;
this.runMode = false;
AsyncScheduler.delegate = undefined;
}
}
}

0 comments on commit 27cb9b6

Please sign in to comment.