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

Add factory functions for sandbox and fake server #1515

Merged
merged 2 commits into from
Aug 7, 2017

Conversation

mantoni
Copy link
Member

@mantoni mantoni commented Aug 6, 2017

As discussed in #1514, this adds the following methods as aliases:

  • createSandbox = sandbox.create
  • createFakeServer = fakeServer.create
  • createFakeServerWithClock = fakeServerWithClock.create

Also adjusted the docs to show the new functions. Is it okay to suggest the new functions only? Or do we want to keep API docs for the "old" functions?

Did I miss anything else?

This adds the following methods as aliases:

- createSandbox = sandbox.create
- createFakeServer = fakeServer.create
- createFakeServerWithClock = fakeServerWithClock.create
sinon = proxyquire("../lib/sinon", {
nise: fakeNise
nise: fakeNise,
"./sinon/sandbox": fakeSandbox
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to go through proxyquire to get the correct reference to the sandbox instance. I tried using a reference to the sandbox module directly, which worked on node but it failed in browsers.

Copy link
Contributor

@fatso83 fatso83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine by me. Does not see the need to document the old functions.

@fatso83 fatso83 merged commit 1f2d2e3 into master Aug 7, 2017
@fatso83 fatso83 deleted the create-factory-functions branch August 7, 2017 19:58
lencioni added a commit to lencioni/sinon-sandbox that referenced this pull request Jul 3, 2018
This method was added in sinon v3.10.0:

  sinonjs/sinon#1515

and a deprecation warning for sinon.sandbox.create was added in sinon
v5.0.1:

  - sinonjs/sinon#1768
  - sinonjs/sinon@4fc7c65d#diff-7ac78866bb2aab0e4513c3e57f189c88R50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants