xref: /third_party/node/deps/npm/test/fixtures/tnock.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/deps/npm/test/fixtures/
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

Indexes created Thu Nov 07 10:32:03 CST 2024