JavaScript Tests in Node, the Browser, and CI
summary
Builds a repo with a start and done folder and runs specific examples: mocha + chai for assertions, tests that cover synchronous code, callbacks, promises and async/await, and a monkey‑patched jQuery ajax to test DOM code. Uses karma with headless Chrome and Firefox to run browser tests in CI via npm test, demonstrates debugging breakpoints, and finds/fixes a divide‑by‑zero bug. Ends with automated single‑run CI and passing cross‑browser test runs (local counts: ~9 then ~18 tests).
AI-written summary · about
chapters (12)
- 0:00Introduction
- 2:32First test in Node
- 10:09Testing async callbacks
- 15:34Testing promises
- 18:53Async/await tests
- 20:17Testing edge cases
- 26:42Tests as documentation
- 28:06Testing in the browser
- 34:35Debugging browser tests
- 36:28Mocking jQuery AJAX
- 44:35Running tests in CI
- 52:30Summary and resources
related talks
45mAutomated Testing JavaScript
25mMaking JavaScript Tests Fast, Easy, and Friendly
42mSurviving the JS Testing Tools Jungle
37mSay No(de) to the Browser: Testing your Webapp Frontend Code Using Just Node
47mPractical Testing with JavaScript
37mCross browser unit testing JavaScript
45mWriting Tests That Don't Suck: TDD in JavaScript
01h 02mWriting better tests for your JavaScript app
