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

Error in documentation (Sandbox) #1795

Closed
vokrik opened this issue May 16, 2018 · 4 comments
Closed

Error in documentation (Sandbox) #1795

vokrik opened this issue May 16, 2018 · 4 comments

Comments

@vokrik
Copy link

vokrik commented May 16, 2018

Describe the bug
screen shot 2018-05-16 at 12 39 09

Since later on in the documentation it says that sinon itself is a default sandbox, I think the require should be following:
var sandbox = require('sinon')

Context (please complete the following information):

@vokrik
Copy link
Author

vokrik commented May 16, 2018

Hmmm... looking back at it I am not sure...

I thought it was like that but apparently, the sinon itself is not a sandbox.

However if I do const sandbox = require('sinon').sandbox
and then console.log(sandbox)
I get { create: [Function: wrapped] } instead of an instance of sandbox. I think there might be a problem with how the sandbox is extended with the create function for compatibility with deprecated versions.

can somebody reproduce it?

@stale
Copy link

stale bot commented Jul 15, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@eveadele
Copy link

It seems like this error has been corrected -- the sandbox docs now look like this:

Screenshot 2023-05-10 at 12 19 03 PM

I tried out the code and I think it works as expected. Is it safe to call this issue solved?

@fatso83
Copy link
Contributor

fatso83 commented May 12, 2023

I have long forgotten about this, but I think the whole premise was wrong:

I think the require should be following:
var sandbox = require('sinon')

While, yes, Sinon is a sandbox, the docs are about sandboxes specifically and how to use them, so it makes sense to create one.

If you want proof that Sinon is a sandbox, just take a look at ./lib/sinon.js which has this code:

var sandbox = new Sandbox();
var api = extend(sandbox, apiMethods);
module.exports = api;

@fatso83 fatso83 closed this as completed May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants