Skip to content

Instantly share code, notes, and snippets.

@yorkie
Created August 6, 2014 12:47
Show Gist options
  • Save yorkie/2a4083f222caabb32b09 to your computer and use it in GitHub Desktop.
Save yorkie/2a4083f222caabb32b09 to your computer and use it in GitHub Desktop.
var sinon = require('sinon');
var clock = sinon.useFakeTimer();
setTimeout(function timer() {
console.log('...')
}, 1000);
// if we set:
clock.tick(1000); // timer will be called
// if we set:
clock.tick(999); // timer will not be called
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment