- Sinon version : master
- Environment :
- Example URL :
- Other libraries you are using:
What did you expect to happen?
Creating a fake server with sandbox.useFakeServer() should create a fakeServer instance. (According to docs here: http://sinonjs.org/releases/v3.2.0/sandbox/)
What actually happens
It creates a fakeServerWithClock instance.
How to reproduce
var sandbox = sinon.sandbox.create();
sandbox.useFakeServer();
// Verify sandbox.server is a fakeServerWithClock
Workaround is to manually set sandbox.serverPrototype before calling .useFakeServer() since unlike creating server from the sandbox config, there is no way to specify the server prototype when calling the method version of useFakeServer.
This appears to simply be due to setting the wrong prototype here:
|
serverPrototype: fakeServerWithClock, |
So the default || fakeServer is never reached:
|
var proto = this.serverPrototype || fakeServer; |
.
What did you expect to happen?
Creating a fake server with
sandbox.useFakeServer()should create afakeServerinstance. (According to docs here: http://sinonjs.org/releases/v3.2.0/sandbox/)What actually happens
It creates a
fakeServerWithClockinstance.How to reproduce
Workaround is to manually set
sandbox.serverPrototypebefore calling.useFakeServer()since unlike creating server from the sandbox config, there is no way to specify the server prototype when calling the method version ofuseFakeServer.This appears to simply be due to setting the wrong prototype here:
sinon/lib/sinon/sandbox.js
Line 58 in d9cae73
So the default
|| fakeServeris never reached:sinon/lib/sinon/sandbox.js
Line 61 in d9cae73