Skip to content

Add factory functions for sandbox and fake server - #1515

Merged
fatso83 merged 2 commits into
masterfrom
create-factory-functions
Aug 7, 2017
Merged

fatso83 merged 2 commits into
masterfrom
create-factory-functions

Conversation

@mantoni

@mantoni mantoni commented Aug 6, 2017

Copy link
Copy Markdown
Member

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?

mantoni added 2 commits August 6, 2017 16:57
This adds the following methods as aliases:

- createSandbox = sandbox.create
- createFakeServer = fakeServer.create
- createFakeServerWithClock = fakeServerWithClock.create
@mantoni
mantoni force-pushed the create-factory-functions branch from 8bad63c to 6648f1b Compare August 6, 2017 14:57
Comment thread test/sinon-test.js
sinon = proxyquire("../lib/sinon", {
nise: fakeNise
nise: fakeNise,
"./sinon/sandbox": fakeSandbox

Copy link
Copy Markdown
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.

@fatso83 fatso83 left a comment

Copy link
Copy Markdown
Contributor

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