question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tests with error return fail with version 3.4.0

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:9
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

14reactions
akirilyukcommented, Jan 16, 2019

Hi, I am also experiencing the same issue!

5reactions
gergaczdcommented, Jan 16, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tests with error return fail with version 3.4.0 #534 - GitHub
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 ...
Read more >
Unit Tests Failing After Updating React Scripts from v.3.4.4 to v ...
Basically, the main error I'm seeing seems to apply to any tests running against async/await methods. Jest reports that the test times out...
Read more >
General tips and tricks — tox 3.4.0 documentation
When a command (defined by commands = in tox.ini ) fails, it has a non-zero exit code, and an InvocationError exception is raised...
Read more >
COMMISSION SMART Tests fail unnecessarily on code 64 ...
If a disk has *old* indications of failure in its SMART log, a return code of 64 is provided. This causes MAAS to...
Read more >
Mockito (Mockito 4.10.0 API) - javadoc.io
Minimizes repetitive mock creation code. Makes the test class more readable. Makes the verification error easier to read because the field name is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found