How to use the emitter function from nock

Find comprehensive JavaScript nock.emitter code examples handpicked from public code repositorys.

25
26
27
28
29
30
31
32
33
34
35
};


function initNock() {
  nock.disableNetConnect();
  const logRequest = (r) => console.log(`No match: ${r.path}, method: ${r.method}, host: ${r.options.host}`);
  nock.emitter.on('no match', (req) => {
    logRequest(req);
  });
}

fork icon46
star icon128
watch icon0

0
1
2
3
4
5
6
7
8
9
10
11
12
'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()
fork icon0
star icon0
watch icon0