If you’re trying to ship quickly (and not just move fast and break everything), good unit tests are one of the best accelerators you can invest in. Here’s a short list of tools and resources that have helped me level up JavaScript testing.
Wallaby
Wallaby runs your tests as you type. The killer feature is the immediate pass/fail feedback right in your editor gutter—no waiting, no guessing.
Docs: Wallaby docs
Mocha
Mocha is a flexible test runner with a huge ecosystem. The describe(...) / it(...) style is approachable, and you can debug tests nicely in editors like VS Code.
VS Code debugging: Debugging
Chai
Chai is an assertion library that pairs well with Mocha.
- BDD style: Chai BDD
- Promises:
chai-as-promised(handy if you’re writing async tests) - Background: Promises (MDN)
WebdriverIO
WebdriverIO provides Selenium bindings for Node.js—i.e. you can drive a browser with JavaScript for end-to-end testing.
Intern / Chimp (meta-frameworks)
Intern and Chimp are “meta-frameworks”: they bundle multiple testing tools into a more opinionated package to reduce setup friction (Selenium, PhantomJS, Mocha, etc.). If you’re early in your testing journey, that convenience can be worth it.
Cucumber.js
Cucumber.js is Cucumber for JavaScript: it uses Gherkin to express tests in natural language, commonly used in BDD workflows.
Finally: all of these tools work great with Visual Studio Code. If you’re doing Salesforce work, VS Code integrates nicely via ForceCode.
What do you use for unit testing?
