node/deps/npm/test/fixtures/tnock.js

18 lines
378 B
JavaScript

'use strict'
const nock = require('nock')
// Uncomment this to find requests that aren't matching
// nock.emitter.on('no match', req => console.log(req.options))
module.exports = tnock
function tnock (t, host, opts) {
nock.disableNetConnect()
const server = nock(host, opts)
t.teardown(function () {
nock.enableNetConnect()
server.done()
})
return server
}