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

Add support for promises in expect #401

Closed
LegNeato opened this issue Feb 1, 2017 · 6 comments
Closed

Add support for promises in expect #401

LegNeato opened this issue Feb 1, 2017 · 6 comments
Labels
too-old Item to old

Comments

@LegNeato
Copy link

LegNeato commented Feb 1, 2017

Right now, if you have a promise in expect (for, say, an async function) it will be run but errors will not be detected.

LegNeato added a commit to LegNeato/supertest that referenced this issue Feb 1, 2017
LegNeato added a commit to LegNeato/supertest that referenced this issue Feb 2, 2017
LegNeato added a commit to LegNeato/supertest that referenced this issue Feb 2, 2017
LegNeato added a commit to LegNeato/supertest that referenced this issue Feb 2, 2017
@LegNeato
Copy link
Author

LegNeato commented Feb 2, 2017

Pushed again to fix an issue with passing expect()s never calling the async resolver and timing out. Also added a test for the case.

@ianstormtaylor
Copy link

Would love to use this!

@selenium-tester
Copy link

Thank you @LegNeato!

@rimiti rimiti added the too-old Item to old label Mar 9, 2019
@rimiti rimiti closed this as completed Mar 9, 2019
@Fundebug
Copy link

Fundebug commented Jun 19, 2019

@LegNeato It seems the problem is not solved.

I‘m using supertest@4.0.2.

I find that the AssertionError will not be detected when I use async/await in expect.

 .expect(async res => {
     const orderId = res.body.orderId;
     const order = await Order.findById(orderId).lean(); // { price: 10 }

     // the AssertionError will not be detected
     order.should.deepEqual({
         price: 50
     });
 });

@gcherem
Copy link

gcherem commented Oct 3, 2020

@LegNeato, I'm afraid the problem is still there yet.

I also need to call an async method there too!

Is there a workaround for that? Thanks

@LegNeato
Copy link
Author

LegNeato commented Oct 3, 2020

I don't know, it could have regressed since this was landed years ago. I only use Rust these days so sadly can't help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
too-old Item to old
Projects
None yet
Development

No branches or pull requests

6 participants