Created
February 26, 2017 15:39
-
-
Save Gvozd/291e4f0adf247ff70ed72150059e4977 to your computer and use it in GitHub Desktop.
Timings of call sinon-stubs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let sinon = require('.'); | |
class Foo { | |
bar() { | |
} | |
} | |
test('without stubing'); | |
sinon.stub(Foo.prototype, 'bar').callsFake(function() {}); | |
test('with stubing'); | |
function test(name) { | |
console.time(name); | |
let foo = new Foo(); | |
for(let i = 0; i < 10 * 1000; i++) { | |
foo.bar(); | |
} | |
console.timeEnd(name); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment