UNPKG

fancy-test

Version:

extendable utilities for testing

21 lines 556 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = (host, cb) => { const nock = require('nock'); const intercepter = nock(host); return { async run(ctx) { ctx.nock = ctx.nock || 0; await cb(intercepter); ctx.nock++; }, finally(ctx) { if (!ctx.error) intercepter.done(); ctx.nock--; if (ctx.nock === 0) nock.cleanAll(); }, }; }; //# sourceMappingURL=nock.js.map