Package Exports
- ava
- ava/api
- ava/cli
- ava/cli.js
- ava/lib/assert
- ava/lib/cli
- ava/lib/reporters/mini
- ava/lib/reporters/tap
- ava/lib/reporters/verbose
- ava/lib/serialize-error
- ava/lib/watcher
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ava) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Futuristic test runner
Even though JavaScript is single-threaded, IO in Node.js can happen in parallel due to its async nature. AVA takes advantage of this and runs your tests concurrently, which is especially beneficial for IO heavy tests. In addition, test files are run in parallel as separate processes, giving you even better performance and an isolated environment for each test file. Switching from Mocha to AVA in Pageres brought the test time down from 31 to 11 seconds. Having tests run concurrently forces you to write atomic tests, meaning tests don't depend on global state or the state of other tests, which is a great thing!

Read our contributing guide if you're looking to contribute (issues/PRs/etc).
Follow the AVA Twitter account for updates.
This documentation covers the 1.0 beta releases, which use Babel 7. The last release that uses Babel 6 is v0.25.0.
Translations: Español, Français, Italiano, 日本語, 한국어, Português, Русский, 简体中文
Why AVA?
- Minimal and fast
- Simple test syntax
- Runs tests concurrently
- Enforces writing atomic tests
- No implicit globals
- Includes TypeScript & Flow type definitions
- Magic assert
- Isolated environment for each test file
- Write your tests using the latest JavaScript syntax
- Promise support
- Async function support
- Observable support
- Enhanced assertion messages
- Automatic parallel test runs in CI
- TAP reporter
Usage
To install and set up AVA, run:
npx create-ava --nextYour package.json will then look like this (exact version notwithstanding):
{
"name": "awesome-package",
"scripts": {
"test": "ava"
},
"devDependencies": {
"ava": "1.0.0-beta.4"
}
}Or if you prefer using Yarn:
yarn add ava@next --dev --exactAlternatively you can install ava manually:
npm install --save-dev --save-exact ava@nextDon'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:
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 testOr with npx:
npx avaRun with the --watch flag to enable AVA's watch mode:
npx ava --watchSupported 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.
Latest JavaScript support
AVA uses Babel 7 so you can use the latest JavaScript syntax in your tests. There is no extra setup required. You don't need to be using Babel in your own project for this to work either.
We aim support all finished syntax proposals, as well as all syntax from ratified JavaScript versions (e.g. ES2017). See our @ava/stage-4 preset for the currently supported proposals.
Please note that we do not add or modify built-ins. For example, if you use Object.entries() in your tests, they will crash in Node.js 6 which does not implement this method.
You can disable this syntax support, or otherwise customize AVA's Babel pipeline. See our Babel recipe for more details.
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:
- Writing tests
- Execution context
- Assertions
- Snapshot testing
- Command line (CLI)
- Configuration
- Test timeouts
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
- Test setup
- Code coverage
- Watch mode
- Endpoint testing
- When to use
t.plan() - Browser testing
- TypeScript
- Flow
- Configuring Babel
- Using ES modules
- Passing arguments to your test files
- Testing React components
- Testing Vue.js components
- JSPM and SystemJS
- Debugging tests with Chrome DevTools
- Debugging tests with WebStorm
- Isolated MongoDB integration tests
- Testing web apps using Puppeteer
FAQ
Why not mocha, tape, tap?
Mocha requires you to use implicit globals like describe and it with the default interface (which most people use). It's not very opinionated and executes tests serially without process isolation, making it slow.
Tape and tap are pretty good. AVA is highly inspired by their syntax. They too execute tests serially. Their default TAP output isn't very user-friendly though so you always end up using an external tap reporter.
In contrast AVA is highly opinionated and runs tests concurrently, with a separate process for each test file. Its default reporter is easy on the eyes and yet AVA still supports TAP output through a CLI flag.
How is the name written and pronounced?
AVA, not Ava or ava. Pronounced /ˈeɪvə/ ay-və.
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
Related
- eslint-plugin-ava - Lint rules for AVA tests
- sublime-ava - Snippets for AVA tests
- atom-ava - Snippets for AVA tests
- vscode-ava - Snippets for AVA tests
- gulp-ava - Run tests with gulp
- grunt-ava - Run tests with grunt
- More…
Links
Team
![]() |
![]() |
![]() |
|---|---|---|
| Mark Wubben | Sindre Sorhus | Vadim Demedes |



