1

I am trying to pass through to a real webservice in an acceptance test in my project. Pretender intercepts all xhr request so i'm trying to tell it to pass through for example.com

according to the docs i should be able to do this.

var server = new Pretender(function(){
  this.get('https://www.example.com/:catchall', this.passthrough);
});

or this

var server = new Pretender();
server.get('https://www.example.com', server.passthrough);

but I get this in my console.

Uncaught TypeError: Pretender intercepted GET https://www.example.com/foo/bar but encountered an error: handler.handler is not a function(…)

because

handler.handler is server.passthrough and server.passthrough is an object?

> server.passthrough 
 Object {numberOfCalls: 1, async: undefined}

The test passes in isolation but fails when i run the full suite on the console with npm test. it also passes in the browser. I think i have either a race condition.

David Chan
  • 7,347
  • 1
  • 28
  • 49

0 Answers0