Vite is a French word meaning “quick”. This cute little puppy also looks quick. Photo by Leo Rivas on Unsplash

Introduction to Vitest: in-source testing using Typescript

Vitest is a JavaScript testing toolkit designed to make setting up, writing, and running tests easy. It’s packed with cool features which makes it a great alternative to Jest.

Kris Raven
Published in
6 min readNov 27, 2022

--

Without going into too much detail Vitest uses Vite. Vite is a build tool that allows developers to set up a development environment quickly. The biggest benefit is that it’s quick. Compared to other CLI tools like CRA or other Webpack-powered tools, Vite is fast. This makes Vitest a blazing fast unit test framework (not my words but the words of vitest.dev). Ahem. More selling points of Vite include having out of the box TypeScript support. In late 2022, supporting Typescript by default somehow doesn’t seem that big a selling point as it once did. Catching bugs in code early is better than not catching those bugs though, right?

There’s also support for CSS pre-processors in Vite. So it doesn’t need to use any Javascript compilers like Babel or Webpack. Interestingly, Vite is framework-agnostic. I’ll get into why this is “interesting” later on. There are official templates for many Javascript frameworks. These include React, Svelte and Vue. Vite also offers a way to create library bundles.

--

--

Kris Raven
Writer for

Quality Engineering Manager | A wholesome mix of QA, Automated Testing, music and philosophy | Enjoys unit tests | Favours integration tests