ava README

The project's README from github.com/avajs/ava. As one markdown file: README.md.

Please support our friend Vadim Demedes and the people in Ukraine.


AVA logo

AVA is a test runner for Node.js with a concise API, detailed error output, embrace of new language features and thread isolation that lets you develop with confidence 🚀

Watch this repository and follow the Discussions for updates.

Read our contributing guide if you're looking to contribute (issues / PRs / etc).

Translations: Español, Français, Italiano, 日本語, 한국어, Português, Русский, 简体中文

Why AVA?

Usage

To install and set up AVA, run:

npm init ava

Your package.json will then look like this (exact version notwithstanding):

{
	"name": "awesome-package",
	"type": "module",
	"scripts": {
		"test": "ava"
	},
	"devDependencies": {
		"ava": "^5.0.0"
	}
}

Or if you prefer using Yarn:

yarn add ava --dev

Alternatively you can install ava manually:

npm install --save-dev ava

Make sure to install AVA locally. AVA cannot be run globally.

Don't forget to configure the test script in your package.json as per above.

Create your test file

Create a file named test.js in the project root directory.

Note that AVA's documentation assumes you're using ES modules.

import test from 'ava';

test('foo', t => {
	t.pass();
});

test('bar', async t => {
	const bar = Promise.resolve('bar');
	t.is(await bar, 'bar');
});

Running your tests

npm test

Or with npx:

npx ava

Run with the --watch flag to enable AVA's watch mode:

npx ava --watch

Supported Node.js versions

AVA supports the latest release of any major version that is supported by Node.js itself. Read more in our support statement.

Highlights

Magic assert

AVA adds code excerpts and clean diffs for actual and expected values. If values in the assertion are objects or arrays, only a diff is displayed, to remove the noise and focus on the problem. The diff is syntax-highlighted too! If you are comparing strings, both single and multi line, AVA displays a different kind of output, highlighting the added or missing characters.

Clean stack traces

AVA automatically removes unrelated lines in stack traces, allowing you to find the source of an error much faster, as seen above.

Parallel runs in CI

AVA automatically detects whether your CI environment supports parallel builds. Each build will run a subset of all test files, while still making sure all tests get executed. See the ci-parallel-vars package for a list of supported CI environments.

Documentation

Please see the files in the docs directory:

Common pitfalls

We have a growing list of common pitfalls you may experience while using AVA. If you encounter any issues you think are common, comment in this issue.

Recipes

FAQ

How is the name written and pronounced?

AVA, not Ava or ava. Pronounced /ˈeɪvə/: Ay (face, made) V (vie, have) A (comma, ago)

What is the header background?

It's the Andromeda galaxy.

What is the difference between concurrency and parallelism?

Concurrency is not parallelism. It enables parallelism.

Support

Team

Mark Wubben Sindre Sorhus
Mark Wubben Sindre Sorhus
Former



AVA

ava (avajs/ava)

Searching Database…

20.8K ·GitHub
What is this?AVA is a test runner for Node.js: it runs your tests with a concise API, detailed error output and thread isolation, so you can develop with confidence.
Is it a library I import into my code, or a tool I run?A command-line tool: you install it into your project and it runs your test files through a test script in package.json (or directly with npx ava).
How do I get it running?Install it locally with npm or Yarn, configure the test script in package.json, create a test.js file in the project root, then run your tests with npx ava — add the --watch flag to rerun them as you edit.
What do I need installed to use it?Just Node.js itself — AVA supports the latest release of any major version that Node.js supports (its engines field currently asks for ^22.20, ^24.12 or >=26).
Any install pitfalls?Yes — AVA cannot be run globally; it must be installed locally in each project. The documentation also assumes you're using ES modules, and there's a maintained list of common pitfalls.
Why pick AVA over other Node.js test runners?Tests run concurrently with an isolated environment for each test file, so they stay fast and atomic; it enforces no implicit globals, cleans unrelated lines out of stack traces, and automatically splits test files across parallel CI builds. A TAP reporter is included too.
What is the 'magic assert'?AVA's assertion output shows code excerpts and clean diffs between actual and expected values. For objects and arrays it displays only the diff, syntax-highlighted; for strings it highlights exactly which characters were added or are missing.
Can I write my tests in TypeScript?Yes — TypeScript definitions are included out of the box, there's a TypeScript recipe in the docs, and the companion @ava/typescript package is made for testing TypeScript projects.
What can I test beyond plain unit tests?The recipes cover endpoint testing, browser testing with Puppeteer or Selenium, Vue.js components, isolated MongoDB integration tests, code coverage, and debugging tests with Chrome DevTools, VSCode or WebStorm.
What are similar projects?testify, enzyme, mocha, pytest, karma, jasmine, jest, zenc
Creator
avajs
Size
14.4 MB
Stars
20.8K
Age
11y
Commits · 90 Days