Course · Training · Workshop

Vitest - JS/TS Testing Framework

One to two days of intensive introduction to modern unit and integration testing with Vitest for JavaScript and TypeScript projects.

Vitest – The ultra-fast testing framework for modern web development. Experience lightning-fast execution, built-in TypeScript support, and a familiar Jest-like API – optimized for projects using Vite, but flexible enough for any setup. Vitest delivers instant feedback, smart watch mode, and seamless integration with your dev tools. Less waiting, more developing.

What participants say

These customers booked courses in the same topic cluster.More customers →

Content

During the course, we develop step by step a comprehensive set of unit and integration tests for a modern JavaScript/TypeScript application. We focus on the practical application of Vitest:

– Overview and Architecture of Vitest:

  • Comparison Vitest vs. Jest vs. Mocha
  • Vite integration and performance benefits
  • Installation and project setup
  • Configuration and workspace setup – Fundamentals of Unit Testing:
  • Test structure and best practices
  • Describe, test, and it blocks
  • Assertions and matchers
  • Setup and teardown (beforeEach, afterEach) – Mocking and Stubbing:
  • Function mocks and spies
  • Module mocking
  • Timer mocks (vi.useFakeTimers)
  • Date and random mocking
  • Partial mocks – Asynchronous Testing:
  • Promises and async/await
  • Callbacks and done
  • Timeout handling
  • Concurrent tests – Integration Testing:
  • Testing component interactions
  • API integration tests
  • Database mocking
  • Environment-specific tests – Frontend Testing with Vitest:
  • DOM testing with happy-dom/jsdom
  • Component testing (React, Vue, Svelte)
  • Testing Library integration
  • Event handling and user interactions – Code Coverage:
  • Coverage reports with c8/istanbul
  • Coverage thresholds
  • Branch and line coverage
  • Identifying uncovered code – Snapshot Testing:
  • Inline snapshots
  • File snapshots
  • Snapshot updates and management
  • Custom serializers – Performance and Optimization:
  • Parallel test execution
  • Test sharding
  • Watch mode and HMR
  • Benchmark tests with Vitest Bench – Advanced Features:
  • Custom matchers
  • Test context and fixtures
  • In-source testing
  • Type testing with expect-type – CI/CD Integration:
  • GitHub Actions, GitLab CI integration
  • Test reports and artifacts
  • Parallel CI runs
  • Docker-based test environments

The course is based on refined and tested course material with explanation, practical exercises, course project with code, solution code, and further information.

You will not only learn these concepts but also implement them practically.

The actual course content may differ from the above depending on the trainer, delivery, duration and the composition of participants.

Request this course in-house

By submitting you accept our Privacy Policy.

Request a public date

No suitable public date? Register without obligation — once there is enough interest we schedule a new public date and let you know first.

Number of participants (approx.)

More than 3 participants? Best to request a dedicated in-house date directly.

By submitting you accept our Privacy Policy.

More about Vitest

Vitest is a modern unit testing framework developed by the Vite community, specifically optimized for the requirements of modern JavaScript and TypeScript projects. It offers native ESM support, blazing-fast test execution through Vite's transformation pipeline, and a Jest-compatible API for easy migration.

Further resources:

History

Vitest was developed in 2021 by Anthony Fu and the Vite team when the need for a modern testing framework that works seamlessly with Vite was recognized. The project emerged from the realization that existing testing tools like Jest were not optimally suited for ESM-based projects and Vite's fast transformation pipeline.

Development was significantly driven by the Vite community, with important contributions from developers like Hiroshi Ogawa and Patak. Key milestones included the introduction of Browser Mode (2022), Workspace Support for monorepos (2023), and Vitest UI for a graphical test interface. The Jest-compatible API enabled many projects to migrate easily.

Today, Vitest is one of the fastest-growing testing frameworks in the JavaScript ecosystem and is used by major projects like Nuxt, Vue, and Vite itself. It has set new standards for performance and developer experience in testing and, with its native TypeScript and ESM support, offers a modern alternative to established tools. The close integration with the Vite ecosystem and the active community ensure continuous development.