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

disableNetConnect is set with NOCK_BACK_MODE set to 'record' #1756

Closed
meelash opened this issue Oct 19, 2019 · 2 comments
Closed

disableNetConnect is set with NOCK_BACK_MODE set to 'record' #1756

meelash opened this issue Oct 19, 2019 · 2 comments
Labels

Comments

@meelash
Copy link

meelash commented Oct 19, 2019

I'm not exactly sure if this is a documentation shortcoming, bug, faulty implementation, expected behavior, necessary evil, or what but it is very easy to reproduce and was throwing me for a loop, so I'm reporting it.

It is very easy to reproduce:
https://repl.it/repls/AngryZestyGraphics

process.env.NOCK_BACK_MODE='record';
const http = require('http');
require('nock');

http.get('http://www.google.com');

If you comment the first line, the request will go through, if not, it throws the error.

@paulmelnikow
Copy link
Member

Hi! I'm not super-familiar with how Nock Back works, so I'm not sure what Nock's behavior should be when NOCK_BACK_MODE is set but you're outside of a nockBack call.

As far as I know this is the correct usage for Nock Back, which comes from the readme example:

process.env.NOCK_BACK_MODE = 'record'
const http = require('http')
const nock = require('.')

nock.back.fixtures = __dirname + '/fixtures'

nock.back('goog.json', done => {
  http.get('http://www.google.com')
  done()
})

It works with or without the env var.

@stale
Copy link

stale bot commented Jan 19, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We try to do our best, but nock is maintained by volunteers and there is only so much we can do at a time. Thank you for your contributions.

@stale stale bot added the stale label Jan 19, 2020
@stale stale bot closed this as completed Jan 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants