algolia / faux-jax

NO MORE MAINTAINED: Intercept and respond to requests in the browser (AJAX) and Node.js (http(s) module)
MIT License
95 stars 10 forks source link

faux-jax 5.0.6 breaking change? #26

Open yanndinendal opened 7 years ago

yanndinendal commented 7 years ago

I get some breaking tests since faux-jax 5.0.6 (they don't happen with 5.0.1 to 5.0.5).

"after all" hook: Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.

Maybe because the update of the mitm dependency? There is something like this in taht test:

function setupFauxJax() {
  fauxJax.install();
  // https://github.com/moll/node-mitm#bypassing-interception
  fauxJax._mitm.on('connect', function trapSomeRequests(socket, opts) {
    if (['some.host', 'other.host']
      .indexOf(opts.host) !== -1) {
      // intercept
      return null;
    }

    socket.bypass();
  });
}

called here in the tests:

  beforeEach(() => {
    setupFauxJax();
  });

  afterEach(() => {
    fauxJax.restore();
  });
vvo commented 7 years ago

The only thing I can tell you is that in between we upgraded to the latest mitm. If you can dig this that's be great. Thanks!