Table of Contents
Preface
Part 1: Learning the TDD Cycle
1
Setting up for Testing
Technical requirements
Creating a new SvelteKit project
Installing and running Playwright
Running Vitest
Preparing your development environment for frequent unit testing
Choosing your editor
Creating a shell alias
Changing the test runner to report each test name
Watching the test fail
Configuring support for Svelte component tests
Installing jsdom and testing library helpers
Writing a test for the DOM
Writing a first Svelte component test
Ensuring the DOM is cleared after each test run
Restoring mocks automatically
Optional configuration
Configuring Prettier’s print width
Reducing the tab width in the Terminal
Summary
2
Introducing the Red-Green-Refactor Workflow ...
Get Svelte with Test-Driven Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.