Where it runs

Testing and quality

Tests are small programs that check your code does what it should, so a change today does not quietly break something that worked yesterday. They run on your machine in seconds and again in CI on every pull request, catching bugs before users do.

They come in layers. Unit tests check one function on its own, integration tests check that pieces work together, and end-to-end tests drive a real browser through whole journeys such as signing up. A test runner (Vitest, Jest, pytest) handles the first two; browser tools (Playwright, Cypress, Puppeteer) handle the last.

10 terms · 3 comparisons · prices checked September 2026

10 terms, click any to open

Kinds of tests

Unit tests

Concept
Small, fast tests that check one piece of code, such as a single function, on its own, by giving it inputs and checking the output.

A unit test might call a calculateTotal function with a cart of two items and a discount code, then assert that the result is exactly what it should be. Because it touches no network, database or browser, hundreds of them run in a second or two, so developers run them constantly while working and CI runs them on every change.

Anything that would make a test slow or unpredictable, such as an API call or the current time, is swapped for a mock or a fake. Unit tests form the base of the testing pyramid: many cheap tests at the bottom, fewer integration tests above them and a handful of end-to-end tests at the top. They are good at pinning down logic and edge cases, and weak at proving the whole app works.

Also called: unit testing, test cases, mocks

Open Unit tests as a page

Integration tests

Concept
Tests that check several pieces working together, such as an API route with its real database, or a screen with its form and validation.

Where a unit test isolates one function, an integration test lets real parts talk to each other. It might start the API, send a request to /orders, and check both the response and the row written to a test database. On the frontend, rendering a whole component with Testing Library and clicking through it is a common form.

They catch the bugs that live where parts meet: a wrong column name, a missing header, a validation rule that disagrees with the server. They are slower and need setup (a throwaway database, seeded data, often run in Docker), so most suites have fewer of them than unit tests, focused on the paths that matter most.

Also called: integration testing, API tests, component tests

Open Integration tests as a page

End-to-end tests

Concept
Tests that drive the real app in a real browser the way a user would, clicking, typing and checking what appears on the screen.

An end-to-end test opens the site, signs up with a test account, adds a product to the cart and checks that the order confirmation appears. Because it exercises the frontend, backend, database and outside services together, a passing run is strong evidence that the whole journey works. Playwright and Cypress are the usual tools; Puppeteer suits lighter automation.

They are the slowest and most fragile layer: timing, test data and third-party services can make a test fail now and then for no real reason (a flaky test). Teams keep them to the critical journeys, such as sign-in, checkout and payments, run them against a preview or staging deployment in CI, and use traces, screenshots and videos to debug failures.

Also called: E2E tests, e2e, browser tests, UI tests, acceptance tests

Open End-to-end tests as a page

Test runners

Vitest

ToolOpen source
A fast test runner for JavaScript and TypeScript built on Vite, with a Jest-compatible API, and a common choice for new web projects.

Vitest reuses a project's Vite configuration, so TypeScript, JSX, ES modules and path aliases work in tests exactly as they do in the app, with no separate Babel setup. Its describe, it, expect and vi.fn() APIs mirror Jest's, which makes moving an existing suite mostly a matter of changing imports. Watch mode reruns only the tests affected by a change, almost instantly.

It covers unit and component tests with jsdom or happy-dom, snapshots, code coverage through V8 or Istanbul, and type tests. Browser Mode runs tests in a real browser through Playwright or WebdriverIO, for components that depend on real browser behaviour. It also works outside Vite projects, such as plain Node.js libraries, and is maintained by the same community as Vite.

Pros

  • Fast start-up and near-instant watch mode
  • TypeScript and ES modules work with no extra setup
  • Jest-compatible API, so switching is straightforward
  • Browser Mode for tests in a real browser

Cons

  • Younger than Jest, with fewer long-standing guides and plugins
  • Some Jest-specific plugins and mocks need reworking

Pick it when

  • Projects built with Vite, including React, Vue, Svelte and Astro apps
  • TypeScript codebases that want tests without transpiler setup
  • New projects choosing a test runner from scratch

Skip it when

  • A large, stable Jest suite where migrating brings little benefit
  • React Native projects, where Jest is the standard

What it costs · Open source

Free (MIT).

Approximate, checked September 2026.

Also called: vitest.config, Vitest Browser Mode, vi.fn

Open Vitest as a pageOfficial site (opens in a new tab)

Jest

ToolOpen source
A long-established JavaScript test runner, originally from Meta, with mocking, snapshots and coverage built in, used by a very large number of existing projects.

Jest bundles everything in one package: a runner that executes test files in parallel, the expect assertion library, jest.fn() mocks and module mocking, fake timers, snapshot testing and code coverage. Tests usually run in Node.js or in jsdom, a simulated browser, which is how React components are commonly tested with Testing Library.

It came out of Meta (Facebook) and has been looked after by the OpenJS Foundation since 2022. It remains the default in React Native and in many established React and Node.js projects. Its weak spots are modern ones: TypeScript needs a transformer such as ts-jest, Babel or SWC, and native ES module support is still marked experimental, which is a large part of why new Vite projects pick Vitest.

Pros

  • Everything built in: runner, assertions, mocks, snapshots and coverage
  • Mature, with answers online for almost any problem
  • The standard in React Native and many existing codebases

Cons

  • TypeScript and ES modules need extra configuration
  • Slower start-up and watch mode than Vitest in many projects
  • jsdom is a simulation, so some browser behaviour differs

Pick it when

  • React Native apps
  • Existing projects that already run on Jest
  • Node.js libraries written in CommonJS

Skip it when

  • New Vite-based projects, where Vitest fits with less setup

What it costs · Open source

Free (MIT).

Approximate, checked September 2026.

Also called: jest.config, snapshot testing, jest.fn

Open Jest as a pageOfficial site (opens in a new tab)

pytest

ToolOpen source
The standard testing framework for most Python projects, where tests are plain functions and checks are ordinary assert statements.

A pytest test is a function whose name starts with test_, and a failing assert shows exactly which values differed. Fixtures supply what tests need, such as a database session or a signed-in client, and clean up afterwards, while @pytest.mark.parametrize runs one test over many inputs. It also runs older unittest-style tests, so projects can switch gradually.

A large plugin ecosystem adds coverage (pytest-cov), parallel runs (pytest-xdist), async tests (pytest-asyncio) and framework helpers such as pytest-django. FastAPI and Django projects commonly pair it with a test client to exercise API routes over HTTP without starting a real server.

What it costs · Open source

Free (MIT).

Approximate, checked September 2026.

Also called: py.test, pytest fixtures, Python testing

Open pytest as a pageOfficial site (opens in a new tab)

Testing Library

LibraryOpen source
A family of helpers for testing user interfaces the way people use them: find the button by its label, click it, and check what the user would see.

Instead of reaching into a component's internal state, Testing Library queries the rendered page by role, label or visible text, for example getByRole('button', { name: 'Pay' }). The user-event package simulates real typing and clicking, and jest-dom adds readable checks such as toBeVisible. Versions exist for React, Vue, Svelte, Angular, plain DOM and React Native.

It is not a test runner: it runs inside Jest or Vitest, usually with jsdom, and Cypress has an adapter, while Playwright's own locators follow the same idea. Because tests find elements the way assistive technology does, they nudge code towards accessible markup, and they survive refactors that do not change what users see.

What it costs · Open source

Free (MIT).

Approximate, checked September 2026.

Also called: React Testing Library, RTL, @testing-library/react, user-event, jest-dom

Open Testing Library as a pageOfficial site (opens in a new tab)

Browser testing and automation

Playwright

ToolOpen source
Microsoft's open-source tool for testing and automating websites in real Chromium, Firefox and WebKit (Safari's engine) browsers through one API.

Playwright drives browsers from code: open a page, click, type, wait for responses and check what appears. Its test runner, Playwright Test, runs tests in parallel across browsers and emulated devices, waits for elements automatically (which cuts down flaky tests), and records traces with screenshots, network logs and a timeline you can step through after a failure.

It was built by the team that created Puppeteer at Google before moving to Microsoft, and it supports JavaScript and TypeScript, Python, Java and .NET. Codegen writes a test while you click through the site, UI mode shows tests running live, and a Playwright MCP server lets AI agents control a browser. Beyond testing, it is widely used for scraping, screenshots and PDFs.

Pros

  • Tests Chromium, Firefox and WebKit with one API
  • Auto-waiting and traces make failures easier to debug
  • Parallel runs and sharding are built in and free
  • Works from TypeScript, Python, Java and .NET

Cons

  • Browser downloads make installs and CI images larger
  • A broad API with more to learn than simple scripting tools
  • Emulates mobile browsers but cannot test native mobile apps

Pick it when

  • End-to-end tests for web apps across all major browser engines
  • Checking WebKit (Safari) behaviour from Windows or Linux
  • Teams that want parallel runs in CI without a paid service

Skip it when

  • Native Android or iOS apps, which need mobile testing tools
  • Pure logic tests, where Vitest, Jest or pytest are faster

What it costs · Open source

Free (Apache 2.0).

Approximate, checked September 2026.

Also called: @playwright/test, Playwright Test, Playwright codegen, Playwright MCP

Open Playwright as a pageOfficial site (opens in a new tab)

Cypress

ToolOpen source
A JavaScript tool for end-to-end and component tests that runs inside the browser next to your app, with a visual runner that shows every step.

Cypress opens a browser with your app on one side and a log of commands on the other. Commands such as cy.get('button').click() retry automatically until they pass or time out, and time-travel snapshots let you hover over any step to see the page as it was at that moment. Because tests run in the same browser as the app, they can stub network requests and reach into the app's code directly.

It supports Chrome-family browsers, Firefox and Electron, with WebKit support still experimental, and tests are written only in JavaScript or TypeScript. Several tabs in one test are not supported, and visiting several domains needs cy.origin. The app is open source; Cypress Cloud is a paid service that records runs, spreads them across CI machines and replays failures.

Pros

  • Visual runner with time-travel snapshots makes debugging approachable
  • Automatic retries and waiting for most commands
  • Component tests and end-to-end tests in one tool
  • Large community and plugin ecosystem

Cons

  • JavaScript and TypeScript only
  • No multi-tab tests, and WebKit support is experimental
  • Parallel runs and replays in CI lean on paid Cypress Cloud

Pick it when

  • Frontend teams who want an interactive, visual way to write tests
  • Component tests for React, Vue or Angular in a real browser

Skip it when

  • You need Safari coverage, several tabs, or a language other than JavaScript
  • You want free parallel runs without extra CI scripting

What it costs · Open source

The app is free (MIT). Cypress Cloud has a free Starter plan with 500 test results a month; Team is from about $67 a month billed yearly.

Cypress pricing (opens in a new tab)Approximate, checked September 2026.

Also called: Cypress App, Cypress Cloud, cy.get

Open Cypress as a pageOfficial site (opens in a new tab)

Puppeteer

ToolOpen source
A Node.js library from Google's Chrome team for controlling Chrome or Firefox from code, often used for screenshots, PDFs, scraping and automation.

Puppeteer launches a browser, usually headless (with no visible window), and gives you an API to open pages, click, type, run scripts in the page, intercept network requests and capture the result. page.pdf() turns a web page into a PDF using its print styles, which makes it a common way to generate invoices and reports from HTML templates.

It talks to Chrome over the Chrome DevTools Protocol and to Firefox over the WebDriver BiDi standard. It is a library rather than a test framework, with no test runner, parallel runs or reports built in, so for end-to-end testing Playwright, which the original Puppeteer authors went on to build, is the closer fit. Running it on serverless platforms needs a slimmed-down Chromium build.

Pros

  • Direct, fine-grained control of Chrome through DevTools
  • Reliable HTML-to-PDF and screenshot generation
  • Small API that is quick to learn for automation scripts

Cons

  • No test runner, assertions or reports; you add your own
  • JavaScript only, and mainly focused on Chrome
  • Heavy for serverless: Chromium is large and slow to start

Pick it when

  • Generating PDFs, screenshots or social images from HTML
  • Scraping and automating tasks in Chrome
  • Scripts that need Chrome DevTools features directly

Skip it when

  • A full end-to-end test suite, where Playwright or Cypress fit better

What it costs · Open source

Free (Apache 2.0).

Approximate, checked September 2026.

Also called: puppeteer-core, headless Chrome

Open Puppeteer as a pageOfficial site (opens in a new tab)

Side by side

Differences

How the options in this area compare on the questions that usually decide the choice.

Unit vs integration vs end-to-end tests

Open as a page: Unit vs integration vs end-to-end tests

The three layers of the testing pyramid. Each catches different bugs at a different cost, and a healthy suite has many unit tests, a fair number of integration tests and a few end-to-end tests.

CompareUnit testsIntegration testsEnd-to-end tests
What it checksOne function or module on its ownSeveral parts working togetherA whole user journey in a browser
SpeedMilliseconds eachFractions of a second to secondsSeconds to minutes each
Setup neededAlmost noneA test database or servicesA running app, browser and test data
Typical toolsVitest, Jest, pytestVitest, Jest, pytest, Testing LibraryPlaywright, Cypress
CatchesLogic and edge-case bugsMismatches between partsBroken journeys users would hit
FlakinessRareOccasionalMost common
How manyManySomeA few, on key journeys
When to runOn every save and every commitOn every pull requestOn pull requests and before a release

How to choose

  • Write unit tests for logic with rules and edge cases, such as prices, dates and permissions.
  • Add integration tests where parts meet: API routes with a real database, forms with their validation.
  • Keep end-to-end tests for the journeys that must never break, such as sign-in and checkout.

Two JavaScript test runners with nearly the same API. Jest is the long-standing default; Vitest is the newer option built on Vite, with TypeScript and ES modules working out of the box.

CompareVitestJest
Built onVite and its pluginsIts own runtime, with Babel transforms
TypeScript and ES modulesWork with no setupNeed ts-jest, Babel or SWC; ESM is experimental
SpeedFast start-up and watch modeSlower to start in large projects
APIJest-compatible (vi.fn, expect)The original (jest.fn, expect)
Real browserBrowser Mode built inNo built-in browser mode; jsdom instead
EcosystemGrowing quicklyVery large and mature
Common inVite, Vue, Nuxt and SvelteKit projectsReact Native and established React apps

How to choose

  • Pick Vitest for new projects, especially anything built with Vite or written in TypeScript.
  • Stay on Jest for React Native, or for a large existing suite that works well.
  • Moving from Jest to Vitest is usually straightforward because the APIs match.

Playwright vs Cypress vs Puppeteer

Open as a page: Playwright vs Cypress vs Puppeteer

All three control real browsers. Playwright and Cypress are built for end-to-end testing; Puppeteer is a lower-level automation library that is often used for PDFs and scraping.

ComparePlaywrightCypressPuppeteer
What it isTesting and automation frameworkTesting framework with a visual runnerBrowser automation library
BrowsersChromium, Firefox, WebKitChrome family, Firefox, ElectronChrome and Firefox
LanguagesJS and TS, Python, Java, .NETJavaScript and TypeScriptJavaScript and TypeScript
Test runnerBuilt in, parallel by defaultBuilt in, visual and interactiveNone; bring your own
Tabs and domainsSeveral of eachOne tab; other domains via cy.originSeveral of each
DebuggingTrace viewer and UI modeTime-travel snapshotsDevTools and logs
Parallel runs in CIFree and built inEasiest with paid Cypress CloudUp to you
Best forCross-browser end-to-end suitesInteractive frontend testingPDFs, screenshots and scraping

How to choose

  • Pick Playwright for cross-browser end-to-end tests, including WebKit, with free parallel runs.
  • Pick Cypress when the team values its interactive runner and Chrome-family and Firefox coverage is enough.
  • Pick Puppeteer for scripts that generate PDFs, take screenshots or automate Chrome, rather than for full test suites.

Crafted in the dark. Shipped to the world.

Tell us what you are building. You get a private project space with a proposal and a line-by-line quote within a day.