043 JSJ Sinon.JS

JavaScript Jabber

Episode | Podcast

Date: Fri, 18 Jan 2013 08:00:00 +0000

<div class="trix-content"> <div>Panel</div><pre>Christian Johansen (twitter github blog) Joe Eames (twitter github blog) Merrick Christensen (twitter github) Jamison Dance (twitter github blog) <br /></pre><div>Discussion<br /> 00:45 - Christian Johansen</div><pre>Test-Driven JavaScript Development <br /></pre><div>Sinon.JS<br /> Gitorious</div><div>01:26 - Sinon.JS</div><div>02:22 - Stubs, Mocks and Spies</div><div>Mocks Aren’t Stubs: Martin Fowler<br /> Mocha</div><div>10:47 - History of Sinon.JS</div><div>12:25 - XHR, HML, HTTP</div><div>13:36 - Mocking the Clock</div><pre>Set Time Out <br /></pre><div>17:22 - Test-Driven JavaScript Development</div><pre>Andrea Giammarchi @WebReflection The Pragmatic Bookshelf Screencasts <br /></pre><div>21:43 - Test Framework</div><div>Buster.JS<br /> js-test-driver</div><div>24:17 - Other Mocking Libraries</div><pre>mockjax <br /></pre><div>26:24 - Mocking Properties</div><div>27:22 - Matchers</div><div>30:46 - Sinon.JS Gotchas</div><div>33:10 - State of Test-Driven Development in JavaScript</div><pre>Strategies for Testing <br /></pre><div>Picks</div><pre>Jack Reacher (Joe) Torchlight II (Joe) Effective JavaScript by David Herman (Merrick) Rdio (Merrick) Adventure Time (Jamison) How to implement an algorithm from a scientific paper: Emmanuel Goossaert (Jamison) Advanced Vim registers (Jamison) Emacs Rocks! (Christian) Simple Made Easy (Christian) LEGO Lord of the Rings (Christian) Testing Clientside JavaScript (Joe) <br /></pre><div>Transcript<br /> MERRICK:  Classy guy.</div><div>[Hosting and bandwidth provided by the Blue Box Group. Check them out at Bluebox.net.]</div><div>[This episode is sponsored by Component One, makers of Wijmo. If you need stunning UI elements or awesome graphs and charts, then go to Wijmo.com and check them out.]</div><div>JAMISON:  Hello friends. Welcome to JavaScript Jabber. This is Episode number 43. Today, we have Joe Eames.</div><div>JOE:  Howdy!</div><div>JAMISON:  Merrick Christensen.</div><div>MERRICK:  Hey guys!</div><div>JAMISON:  And Christian Johansen. And also me, Jamison Dance. But Christian is the special guest today. Do you want to talk a little bit about yourself? Introduce yourself for those of us that don’t know you?</div><div>CHRISTIAN:  Yeah, sure. First of all, hi! I'm in Oslo, Norway up in the cold north. So, I wrote a book about testing JavaScript a couple of years back called ‘Test-Driven JavaScript Development’. And I've done a few open source libraries. Perhaps the one that most people know about is Sinon.JS. And currently, I work at Gitorious.org. So, that’s the brief introduction about me, I guess.</div><div>JAMISON:  Great! Chuck is gone today. He’s at CES, I believe. So, that’s why I'm filling in for him. I think we want to talk mainly about Sinon.JS today. Do you want to just give an overview of it?</div><div>CHRISTIAN:  Sure.</div><div>JAMISON:  For those who have never heard of Sinon.JS, what is it?</div><div>CHRISTIAN:  Sinon.JS is a stubbing and mocking library which means that when you're writing automated tests for your JavaScript, Sinon provides a tool kit to help you test functions and callbacks and stuff like that, to track how they're being used throughout the system. And then, it also provides some utilities to test asynchronous stuff through timers, like Set Time Out and Set Interval and those kinds of things.</div><div>And it also has a fake XMLHttpRequest implementation. So, it allows you to test your client side JavaScript completely decoupled from the server and it gives you an API to mimic the role of the server in your tests. So, you can focus a test on how the client side reacts to various kind of behavior from the server.</div><div>JAMISON:  So, you talked about stubbing and mocking. And I think, that means we have to get into the hairy discussion of the difference between stubs and mocks?</div><div>MERRICK:  And spies.</div><div>JAMISON:  And spies, yeah. D... Support this podcast at — https://redcircle.com/javascript-jabber/donations Advertising Inquiries: https://redcircle.com/brands Privacy & Opt-Out: https://redcircle.com/privacy