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

Issues using async/await with stubbed promises #408

Closed
wants to merge 2 commits into from
Closed

Issues using async/await with stubbed promises #408

wants to merge 2 commits into from

Conversation

BarryThePenguin
Copy link

👋🏻

This is my first expedition into the ember-concurrency source 👀
ember-concurrency is a joy to use, especially with the new TypeScript additions

I've put together a reproduction of an issue I ran into while upgrading to ember 3.24

There's two tests..

  1. "sinon stub promise that fails"
  2. "sinon stub promise that passes"

In both an async method is stubbed with sinon.stub(obj, 'sinonPromise').rejects('An error').

Then the test calls await obj.tryDoStuff() which performs a task that yields the stubbed method.

In the first test I can see asyncErrorsHandled is not set on the task.

That's about as much information as I can provide 😅

@BarryThePenguin
Copy link
Author

I think this might be closely related to #409 too..

@maxfierke
Copy link
Collaborator

@BarryThePenguin is there a way you can reduce this down to a case without sinon? If there's a generalizable reproduction, it might make it easier to determine what's going on without having to disentangle what sinon might be doing (as much as I like sinon, there's fair amount of indirection, typically)

I agree, it does sound like it might be similar to #409 but a generalizable test case can help us confirm

@BarryThePenguin
Copy link
Author

BarryThePenguin commented Mar 9, 2021

I don't know if the latest changes provide much more info.. it's essentially doing the same as sinon.stub(), but we're replacing functions on the instance manually instead..

@maxfierke
Copy link
Collaborator

There seems to be a variance based on version, indicating perhaps there's some dependency difference at play. I ran the tests against master:

  • It passes on Ember 3.8, 3.16, 3.20, and 3.22
  • It fails on Ember 3.12, release (currently 3.25), beta (currently 3.26), canary, and... 3.22 (when run through ember-try, instead of directly)

AFAICT, there haven't been any updates to RSVP or Backburner that I would typically expect would impact this, but I'll keep digging

@machty machty closed this Feb 4, 2024
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.

3 participants