Test runner

The tool that finds your test files, runs them, and prints the pass/fail report. 'npm test' is you calling one.

the thing that runs the teststest commandtest rnnerwhat does npm test actually dotool that finds and runs my test filesthe red and green output thingjest vs vitesthow do I actually run my tests

See it

Live demo coming soon

What it is

A test runner does four dull but load-bearing jobs: find files that look like tests, execute each one, collect what passed and failed, and exit with a status code CI can read. It also hands you the vocabulary you write tests in ('describe', 'it', 'beforeEach') plus watch mode, filtering by name, parallel workers, and a coverage hook. Vitest and Jest own JavaScript, pytest owns Python, 'go test' ships with Go, and Playwright Test is a runner built for browsers.

Pick the one that already understands your build. Vitest reuses your Vite config, so TypeScript, path aliases, and JSX just work; Jest wants its own transform setup. Node now has 'node:test' built in if you want zero dependencies. Whichever you pick, wire it to a single 'test' script so humans and CI run the identical command.

Two traps. First, a test with no assertion in it passes, and so does an async test whose promise you forgot to await, so a green run is not proof anything was checked. Second, many runners can execute test files in parallel, sometimes out of the box (Vitest and Jest spin up workers by default) and sometimes only once you add it (pytest needs pytest-xdist). Check which mode yours is in, because under parallelism any shared database row, temp file, or module-level variable turns into a random failure that only shows up on the busy CI machine.

Ask AI for it

Set up Vitest as the test runner for this project. Add it as a dev dependency, create a vitest.config.ts that reuses the existing Vite aliases, include files matching src/**/*.{test,spec}.ts, enable globals so I don't import describe and it everywhere, and turn on v8 coverage with a text plus lcov reporter. Add 'test', 'test:watch', and 'test:coverage' scripts to package.json, make the plain 'test' script run once and exit non-zero on failure so CI can use it, and write one example test file proving the setup works.

You might have meant

test suitetest caseassertioncode coverageflaky test