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

Tests with error return fail with version 3.4.0 #534

Closed
ilkkaparssinen opened this issue Jan 16, 2019 · 11 comments · Fixed by BrainBackup/bb8#123
Closed

Tests with error return fail with version 3.4.0 #534

ilkkaparssinen opened this issue Jan 16, 2019 · 11 comments · Fixed by BrainBackup/bb8#123

Comments

@ilkkaparssinen
Copy link

ilkkaparssinen commented Jan 16, 2019

When using version 3.4.0 tests that test for backend returning an error (400) fail. Example:

it("Check that backend returns 400 with invalid data", async function() {
    let res = await server
        .post("/api/someurl")
        .send({data: "something invalid"})
        .expect("Content-type", /json/)
        .expect(400);
  });

When using version 3.4.0 this test fails with "Bad request" error even when backend returns correctly 400 status code.

With supertest 3.3.0 code works as expected.

@rimiti
Copy link
Contributor

rimiti commented Jan 16, 2019

Hello @ilkkaparssinen,

Thank you for your feedback, we're investigating this issue.

@4cm4k1
Copy link

4cm4k1 commented Jan 16, 2019

Hi there,

I am experiencing a similar issue with the update.

Here is a gist of the error output: https://gist.github.com/4cm4k1/f1e9bd3d88c3ce1d069de8554a5b411b

Here are the tests being run: https://github.com/4cm4k1/domain-redirects/blob/master/test/index.js

I hope this helps!
Anthony

@rimiti
Copy link
Contributor

rimiti commented Jan 16, 2019

Thank you @4cm4k1 !

@akirilyuk
Copy link

Hi, I am also experiencing the same issue!

@sjparkinson
Copy link

Here's another build failure that may help, https://circleci.com/gh/Financial-Times/tako/175.

@gergaczd
Copy link

Hi,

I have the same issue.
As far as I checked, the problem probably with superagent version upgrade. It had a major version change.
The error thrown from node_modules/superagent/lib/node/index.js:804:15) because the _isResponseOK function only accept status codes as valid between 200 and 300 (node_modules/superagent/lib/request-base.js in row 275).

But I am not familiar with that area.

@rimiti
Copy link
Contributor

rimiti commented Jan 16, 2019

@gergaczd You right, this issue is related with superagent.
I'll temporarily downgrade it to hotfix the package.

After that, we'll make a hard refactoring because, all tests are OK. It's not normal.

@rimiti rimiti mentioned this issue Jan 16, 2019
@rimiti
Copy link
Contributor

rimiti commented Jan 16, 2019

A pull request has been created to hotfix that: #535 🚀
Any feedback is welcome !

@bonesoul
Copy link

same here

@ilkkaparssinen
Copy link
Author

Hotfix #535 fixes my problems (tested by changing my package.json to branch v3.4.1):
"supertest": "https://github.com/visionmedia/supertest.git#v3.4.1"

@rimiti
Copy link
Contributor

rimiti commented Jan 16, 2019

Thanks @ilkkaparssinen.

The hotfix #535 has been published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment