KEMBAR78
Test your Javascript! v1.1 | PDF
Testing JavaScript
© 2013 Eric Wendelin
@eriwen
Eric Wendelin
Blog: eriwen.com
Twitter: @eriwen
Code: git.io/eric
Today, we’ll talk about
• What makes JS testing hard
• A few ways we can make our JS more
testable
• Some tools that make testing easier
Why is testing your
JavaScript important?
The community is
behind in testing
Why is JavaScript so
hard to test?
Un-testable JS is
most of the problem
Don’t do this!
Do this!
Use with caution!
Better!
Don’t do this!
Do this!
Don’t do this!
Do this!
Don’t do this!
Do this!
Writing Tests
1 unit test framework +
1 functional test framework
= Infinite Pocket Bacon
Logic / Computation
unit test
Computation Example
User Interaction
functional test
Interaction Example
sinon.js
sinonjs.org
sinon.js goodies
• Jasmine Adapter
• QUnit Adapter
• Mocha Adapter
• Buster.js Adapter
• Chai-specific matchers
• Jasmine matchers
• ... much more
ember-testing
/ember.js/packages/ember-testing
Karma
karma-runner.github.io
{F*** IT! WE’LL
DO IT LIVE!}
culture of testing
Code at: git.io/eric
Blog: eriwen.com
Twitter: @eriwen

Test your Javascript! v1.1