nock/nock

Nock test suite breaking on Node 8.x

stevenvachon opened this issue · 9 comments

  • My project's test suite breaks
  • Nock's test suite breaks

My tests are breaking in Node.js 8.

Something simple like:

nock('http://example.com')
    .get('/')
    .reply(200, 'Hi!');

Doesn't get intercepted.

Using Node.js 7 it does.

@stevenvachon If you need to mock something in Node.js 8 now I just bashed create-test-server together.

No docs yet but you can see example usage here:
https://github.com/lukechilds/clone-response/blob/master/test/clone-response.js

@lukechilds thank you, but I transitioned from a real test server to nock a while ago and don't want to go back to it

I also run into this issue I see there is already a PR to make nock node 8 ready. I hope it will reviewed fast.

@StarpTech that PR doesn't pass tests, so it's not yet of any use.

@stevenvachon He said that there is only one browserify test failing. Thats a great base. BTW I think I will change to https://github.com/ctimmerm/axios-mock-adapter in combination with the excellent axios http request library. This not a solution for everybody but a much cleaner way to mock http calls in node.

This PR seems to fix the issue: #929

For my own project, where I only use nock to mock responses, I've monkey-patched nock to get the tests to pass: Rob--W/cors-anywhere@70400ab (tested with nock 8.2.1).

Should be fixed in 9.0.14. Please reopen if issue persists.

lock commented

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue and add a reference to this one if it’s related. Thank you!