Loading
Current section: Workshop Introduction 1 exercises
lesson

Advanced Vitest Patterns Introduction

In this workshop, I’ll walk you through practical ways to tailor Vitest to your needs. We’ll look at setup, configuration, and fixtures, then move into writing custom matchers and examining performance.

Along the way, you’ll see how concurrency, isolation, and sharding affect test runs, and how to use them to keep even large suites efficient.

Loading lesson

Transcript

00:00 Hello, my name is Artem and I welcome you to the Advanced VTEST Patterns Workshop. This one is special because it touches on one of my favorite topics when it comes to developer tooling, customization. And today you will learn how to craft the test experience that you want by customizing VTEST. We will start slow and go through some of the things like optimal IDE setup using the

00:19 VTEST extension in Visual Studio Code, how to configure VTEST for things like code coverage or running multiple test projects with their own requirements and expectations. After that, we will continue with test contexts and you will learn how to extend the default test context in VTEST and create your custom fixtures to make your testing life easier.

00:38 Following that, we will have a whole block on assertions and I love that one. You will learn how to write your custom matchers, both symmetric and asymmetric ones. We will talk the difference about the two and when you would use each. And I've saved the best for last, performance. In the last block, you will profile a slow test run by yourself using the built-in instruments

00:58 in VTEST as well as third-party tools. You will see how your tests consume CPU and memory, why that matters and how you can use those reports to figure out what makes your test slow. During all of this, you will take a peek behind the scenes and learn how VTEST orchestrates your test run to understand which areas you can improve and make faster.

01:17 And you will do so by using three main techniques, concurrent tests, disabling test isolation and then introducing sharding for really big test suits. I am extremely excited to go through all of that with you today and I don't want to keep you here any longer. Let's go!