It’s been about one year since we introduced Jasmine as our default for Javascript testing. Looking back it’s easy to declare it a success:
- We test all our new javascript instead of just deciding it isn’t worth the effort.
- Javascript is broken out into files instead of having the temptation of just leaving it inline in a view template.
- Functions are broken down and refactored to be small and testable.
- We’ve even been able to test some complex Closure javascript using Jasmine instead of JSUnit.
- Running the full Jasmine suite is a part of every CI build.
If we’d only achieved a few of these things I’d consider it a big success. For a long time my default approach was to handle Javascript testing through functional Selenium based tests. While these are valuable tests, they certainly don’t help doing TDD with Javascript. Jasmine has finally allowed me to stay in a BDD/TDD workflow when switching between Ruby and Javascript.