byteNative
Testing & Quality

Jest & Vitest

Fast unit and integration tests for dependable code.

What is Jest & Vitest?

Jest and Vitest are test runners for unit and integration tests in JavaScript and TypeScript. Vitest shares its config and transform setup with Vite, runs lightning fast in watch mode and understands TypeScript, ESM and path aliases with no extra effort. Jest is the proven classic with an enormous ecosystem, very mature mocking and snapshot support. Both secure the small but important building blocks of an application, so larger changes never quietly break something.

More in the documentation

How we use it

In every project with its own logic we write the critical functions so they check themselves. On Vite- or Vitest-adjacent stacks we reach for Vitest, because you save a second config and the tests run at the same pace as your dev server. That keeps refactors fear-free and gives you a clear yes or no on every commit.

ts
import { describe, it, expect } from "vitest";
import { slugify } from "./slugify";

describe("slugify", () => {
  it("lowercases and dashes spaces", () => {
    expect(slugify("Hello World")).toBe("hello-world");
  });
});
A concise Vitest test for a pure function.

Good to know

Vitest speaks almost the same API as Jest, so a migration is often just a swap of the import. Watch out for mocking though: Vitest uses vi instead of jest and hoists vi.mock just like Jest, so the mock factory must not reference outer variables.

00Testing & Quality

More tools we work with in the same area.

Which technology fits you?

You don't have to decide that, it's our job. Tell us about your plans.