Skip to content
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

Patch fake server without clock #1648

Merged
merged 3 commits into from
Jan 13, 2018
Merged

Conversation

mantoni
Copy link
Member

@mantoni mantoni commented Jan 12, 2018

Purpose (TL;DR) - mandatory

Use nise.fakeServer as the default sandbox serverPrototype to fix #1534.

Apparently the Chrome installation has changed and it is now necessary to pass the --allow-chrome-as-root flag on Travis like we already do on CircleCI.

Background (Problem in detail) - optional

Creating a sandbox with fake server installed fake timers on the first XHR request. Both ways to install fake servers are affected:

sandbox = sinon.createSandbox({
  useFakeServer: true
});

and

sandbox = sinon.createSandbox();
sandbox.useFakeServer();

Solution - optional

Setting nise.fakeServer as the default serverPrototype on the sandbox fixes the issue.

How to verify - mandatory

The new tests ensure the correct serverPrototype is used and the fake server returned by useFakeServer() is not an instance of fakeServerWithClock anymore.

Checklist for author

  • npm run lint passes
  • References to standard library functions are cached.

The fakeServerWithClock was used which caused fake timers to be
installed on the first XHR request.

Fixes #1534
@mantoni mantoni added Bug semver:patch changes will cause a new patch version Fake Server labels Jan 12, 2018
@mroderick mroderick merged commit ec2496d into master Jan 13, 2018
@mroderick mroderick deleted the patch-fake-server-without-clock branch January 13, 2018 10:21
@fatso83 fatso83 mentioned this pull request Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Fake Server semver:patch changes will cause a new patch version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default server type when using sandbox.useFakeServer() doesn't match documentation
2 participants