-
-
Notifications
You must be signed in to change notification settings - Fork 769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default server type when using sandbox.useFakeServer()
doesn't match documentation
#1534
Comments
Regarding your workaround, it seems overly complicated, why can't you just send in a normal configuration object? This should accomplish the same: sinon.sandbox.create({
useFakeTimers: false,
useFakeServer: true
}) |
Just ran into this issue as well. I can confirm that this installs a fake server without clock: sandbox = sinon.createSandbox({
useFakeServer: true
}); while the following seems to work at first, but installs the fake timers when the first XHR request is made: sandbox = sinon.createSandbox();
sandbox.useFakeServer(); |
Actually it's worse. First config version also fails. I'll send a patch in a minute. |
The fakeServerWithClock was used which caused fake timers to be installed on the first XHR request. Fixes #1534
The fakeServerWithClock was used which caused fake timers to be installed on the first XHR request. Fixes #1534
This has been fixed in |
I made a mistake when building |
The sinon release 4.1.3 - which is currently packaged with UI5 as sinon-4 - has an issue when a fake server is created from a sandbox. The created server unintentionally fakes timers as well and therefore doesn't auto-respond. See sinonjs/sinon#1534 for details. Sinon release 4.1.6 fixes the issue, this change applies the newest available release 4.4.6. Change-Id: If9207574f1e0b7d253ecb15041b15363086fa541
The fakeServerWithClock was used which caused fake timers to be installed on the first XHR request. Fixes sinonjs#1534
What did you expect to happen?
Creating a fake server with
sandbox.useFakeServer()
should create afakeServer
instance. (According to docs here: http://sinonjs.org/releases/v3.2.0/sandbox/)What actually happens
It creates a
fakeServerWithClock
instance.How to reproduce
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 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
|| fakeServer
is never reached:sinon/lib/sinon/sandbox.js
Line 61 in d9cae73
The text was updated successfully, but these errors were encountered: