Trojan War: SinonJS
summary
Presents using SinonJS together with Mocha and Chai to improve test isolation by replacing brittle stubs and handling async returns and exceptions, offering spies, stubs, mocks and fakes with readable matchers. Demonstrates SinonJS sandbox (auto-restores per test), the fake server for HTTP testing, per-call parameter matchers, and describes migrating a large existing test suite (thousands of tests) to this stack while noting documentation issues and migration tradeoffs.
AI-written summary · about
chapters (15)
- 0:00SinonJS intro
- 1:50Choosing SinonJS
- 5:03Test doubles in unit tests
- 8:38Proxy issues with SinonJS
- 12:23Dependency handling
- 17:03Sandboxes and isolation
- 19:49SinonJS drawbacks
- 23:31Stub, spy, mock basics
- 26:29Martin Fowler’s test doubles
- 31:30AAA pattern
- 33:21SinonJS vs others
- 37:08Why others failed
- 40:26Best practices for isolated tests
- 41:49Unit testing theory
- 43:14Q&A
related talks
26mMock & Roll
25mMaking JavaScript Tests Fast, Easy, and Friendly
54mJavaScript Tests in Node, the Browser, and CI
42mSurviving the JS Testing Tools Jungle
27mAutomated Testing for the Modern Web
45mAutomated Testing JavaScript
47mSurviving the JS Testing Tools Jungle
31mGreat Expectations – Understanding nodejs Testing Frameworks
