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

Prepare 5 release #1768

Merged
merged 20 commits into from
Apr 30, 2018
Merged

Prepare 5 release #1768

merged 20 commits into from
Apr 30, 2018

Conversation

mroderick
Copy link
Member

This PR contains a rewritten branch of next, most notable changes are

  • default sandbox on sinon
  • introducing fake
  • introducing sinon.replace* methods
  • removing deprecated spy.reset

@mroderick mroderick requested review from mantoni and fatso83 April 27, 2018 10:32
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.

Seems fine, though I have only casually glanced over it (most is known from earlier).

@mantoni
Copy link
Member

mantoni commented Apr 27, 2018

Thanks Morgan!

One thing I noticed: The documentation for fake yields and yieldsAsync does not match my understanding of the implementation. It should be something like “The fake expects the last argument to be a callback and will invoke it with the given arguments.”

I remember that we talked about this and thought we already fixed the docs, but somehow that seems to have went under the radar.

Unfortunately I can’t make that contribution myself from where I currently work ¯_(ツ)_/¯

@mroderick
Copy link
Member Author

@mantoni I've pushed an extra commit to amend the documentation and provide a better example

Copy link
Member

@mantoni mantoni left a comment

Choose a reason for hiding this comment

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

Looks good 👍 Nice work, thank you!

module.exports = process.nextTick;
}

if (!hasNextTick && hasSetImmediate) {
Copy link
Contributor

Choose a reason for hiding this comment

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

in terms of async scheduling, nextTick and setImmediate aren't exactly the same - nextTick will append the call to the current spin of the loop, and setImmediate schedules it for the next, whenever that happens. Maybe Promise.resolve().then(callback) would be closer, as that will (afaik) do the same thing as nextTick...? It's subtle, but it might be closer to the intended semantics.

ie:

function ping(m){
    return function(){
        console.log(m)
    }
}

ping('start')()
setImmediate(ping('immediate'))
ping('start2')()
setTimeout(ping('timeout'),0)
ping('start3')()
process.nextTick(ping('tick'))
ping('start4')()
Promise.resolve().then(ping('promise'))
ping('start5')()


gives:

start
start2
start3
start4
start5
tick
promise
immediate
timeout

Copy link
Contributor

Choose a reason for hiding this comment

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

it'll be slightly faster when making lots of calls too.

@mroderick mroderick merged commit ac71bfd into sinonjs:master Apr 30, 2018
@mroderick mroderick deleted the prepare-5-release branch April 30, 2018 08:17
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.

4 participants