Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing test for helpers using runHooks being unsettled after resolving #956

Closed
wants to merge 1 commit into from

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Dec 2, 2020

This commit introduces a number of (currently failing) tests that are attempting to confirm that after running various public methods that we are in a settled state.

The tests all fail at the moment, because the Promise.all that is done wihtin runHooks does not go through our custom RSVP.configure('async', fn). This is because the async hook in RSVP
only receives a second argument (the promise argument) in some circumstances but not in the case where the parent promise is not in the pending state (this branch in RSVP). RSVP.Promise.all([undefined, undefined]) is considered
settled immediately, so RSVP.Promise.all().then(fn) returns a promise that will not get our custom promise resolution scheduling.

Since our custom scheduling is not being used here, the normal RSVP integration is used which means that the promise will resolve in the actions queue of the run loop. Ultimately, this is why isSettled() returns false when await runHooks(...) completes: a run loop was started in order to resolve the runHooks promise, but it has not completed yet.

Reproduces the issue reported in #947.

This commit introduces a number of (currently failing) tests that are
attempting to confirm that after running various public methods that
we are in a settled state.

The tests all fail at the moment, because the `Promise.all` that is done
wihtin `runHooks` does **not** go through our custom
`RSVP.configure('async', fn)`. This is because the `async` hook in RSVP
only receives a second argument (the `promise` argument) in some
circumstances but not in the case where the parent promise is not in the
pending state ([this branch in
RSVP](https://github.com/tildeio/rsvp.js/blob/429ade2379dfbfb6e2c6f453b4aeb642515dbb74/lib/rsvp/then.js#L28-L33)).
`RSVP.Promise.all([undefined, undefined])` is considered settled
immediately, so `RSVP.Promise.all().then(fn)` returns a promise that
will **not** get our custom promise resolution scheduling.

Since our custom scheduling is not being used here, the normal `RSVP`
integration is used which means that the promise will resolve in the
`actions` queue of the run loop. Ultimately, this is why `isSettled()`
returns false when `await runHooks(...)` completes: a run loop was
started in order to resolve the `runHooks` promise, but it has not
completed yet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant