jsguides

Tutorial series

Testing Javascript

9 tutorials — follow in order for the best learning path.

  1. JavaScript Testing: Getting Started

    JavaScript testing fundamentals: from why tests matter to writing your first assertions with Jest and Vitest. Covers unit, integration, and E2E strategies.

  2. Unit testing with Jest: a hands-on guide to JavaScript test automation

    A practical guide to unit testing with Jest — the most popular JavaScript testing framework. Covers matchers, setup, async testing, mocking, and best practices.

  3. Unit Testing with Vitest: A Fast, Modern Test Runner

    Learn unit testing with Vitest, the Vite-powered test runner for JavaScript. Covers setup, matchers, mocking, async testing, snapshots, and coverage.

  4. Testing asynchronous code with Jest and Vitest

    Learn testing asynchronous JavaScript code with Jest and Vitest. Covers promises, async/await, timers, callbacks, and concurrent operations with real examples.

  5. Mocking Modules and Dependencies

    Learn mocking modules in Jest and Vitest — replaces dependencies with controlled test doubles so your unit tests stay fast, reliable, and isolated.

  6. Testing DOM code with jsdom in Node.js: a tutorial

    Learn testing DOM code in Node.js with jsdom. Covers setup with Jest, querying and mutating elements, testing events, form validation, fixtures, and pitfalls.

  7. End-to-end testing with Playwright in JavaScript

    Learn end-to-end testing with Playwright for JavaScript, from basic assertions to advanced browser automation for modern web applications.

  8. Code Coverage and CI Integration

    Learn how to measure code coverage, interpret coverage reports, and integrate testing into your CI pipeline for reliable JavaScript projects.

  9. Snapshot Testing in Jest and Vitest: Patterns and Best Practices

    Master snapshot testing in JavaScript with Jest and Vitest. Learn when to use snapshots, how to manage them, and best practices for effective test maintenance.