Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions addon/src/-private/scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ class MicroRoutine {
}
stop() {
this.stopped = true;
this.resolve({ stopped: true });
if (this.state && isPromise(this.state.value)) {
fireCancellation(this.state.value);
}
Expand Down
9 changes: 6 additions & 3 deletions test-app/tests/unit/scheduler-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ module('Unit | scheduler', function (hooks) {
});

test('promise returned from spawn does not resolve if an inner promise resolves after stop', function (assert) {
assert.expect(1);
assert.expect(2);

return spawn(function* () {
spawn(function* () {
Expand All @@ -284,8 +284,11 @@ module('Unit | scheduler', function (hooks) {
});
stop(task);
resolve();
yield task;
assert.ok(false, 'should never get here');
let yielded = yield task;
assert.ok(
yielded.stopped,
'After stopping a Microtask it should yield `{ stopped: true }`.',
);
});
yield microwait();
assert.ok(true, 'got to end');
Expand Down