mercredi 27 février 2019

Enable sinon fakeServer logs

I'm running several tests where I'm mocking http calls using sinon fake server:

import sinon from 'sinon';
...
const fakeServer = sinon.fakeServer.create();
fakeServer.respondWith('POST', '/myapp/myendpoint/pathparam', [201, { 'Content-Type': 'application/json' }, myPayload]);
...

However the fake server is returning a not found error: [404, { }, (empty string)].

I cannot figure out what's going wrong.

Is there any way to activate some kind of logs that tells me what is going on?

After going over sinon's documentation, I cannot find anything about logs or debug flags.

Aucun commentaire:

Enregistrer un commentaire