11cb0ef41Sopenharmony_ci'use strict' 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst nock = require('nock') 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci// Uncomment this to find requests that aren't matching 61cb0ef41Sopenharmony_ci// nock.emitter.on('no match', req => console.log(req.options)) 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_cimodule.exports = tnock 91cb0ef41Sopenharmony_cifunction tnock (t, host, opts) { 101cb0ef41Sopenharmony_ci nock.disableNetConnect() 111cb0ef41Sopenharmony_ci const server = nock(host, opts) 121cb0ef41Sopenharmony_ci t.teardown(function () { 131cb0ef41Sopenharmony_ci nock.enableNetConnect() 141cb0ef41Sopenharmony_ci server.done() 151cb0ef41Sopenharmony_ci }) 161cb0ef41Sopenharmony_ci return server 171cb0ef41Sopenharmony_ci} 18