Programming Study日本語

Disclosure: We earn a commission from Udemy when you buy a course through links on this page.

Vitest 50 Drills: TypeScript Unit Testing from the Ground Up

Vitest 50 Drills: TypeScript Unit Testing from the Ground Up

Udemy · English

About this course

Language
English
Category
Provider
Udemy
Data updated

I can copy Jest's syntax. But I can't explain why it's written that way. — This course exists to get you out of exactly that state. Vitest is a test runner that reuses Vite's transform pipeline directly to execute your tests. Once you grasp this single fact, everything connects on one line: why TypeScript runs with zero config, why `vi.mock` takes effect before your imports, why Promises don't resolve under fake timers. This course builds up that "how it works" understanding systematically through 50 hands-on drills. Learning follows a roadmap of 10 chapters. Chapter 0 nails down Vitest's execution model. Chapter 1 covers the "three levels of equality" (`toBe` / `toEqual` / `toStrictEqual`), asymmetric matchers, and even writing your own custom matchers. Chapter 2 covers data-driven testing with `test.each` / `describe.each` / `test.for`; Chapter 3 covers hook execution order and the dependency graph and scope design of Vitest's fixture mechanism `test.extend`.Chapter 4 is a full system for mocks. The three-tier reset distinction of `mockClear` / `mockReset` / `mockRestore` that trips up so many learners, and the hoisting behavior of `vi.mock`, are made to click through running code. Chapter 5 conquers async testing end to end: `resolves` / `rejects`, fake timers × Promises, `vi.waitFor`, `test.concurrent`, and `retry` for flaky tests. From Chapter 6 we turn to real targets. You'll build designs that verify temporary-file I/O, the repository pattern over in-memory SQLite (`node:sqlite`), and HTTP APIs with Hono and zod as "real I/O, but fast and deterministic." Chapter 7's snapshots show how to remove noise with custom serializers; Chapter 8 covers Vitest-only weapons: in-source tests, type tests (`expectTypeOf`), benchmarks (`bench`), and browser mode. The final chapter closes with a coverage-threshold gate, unit/integration separation via `projects`, and a capstone that implements `PriceCalculator` via TD…

Courses in the same category