Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
A

ava

> 数据库
Open source

Node.js test runner that lets you develop with confidence 🚀

20.8K stars0 likes6 views
WebsiteGitHub

About

Node.js test runner that lets you develop with confidence 🚀

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


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?

  • Minimal and fast
  • Simple test syntax
  • Runs tests concurrently
  • Enforces writing atomic tests
  • No implicit globals
  • Includes TypeScript definitions
  • Magic assert
  • Isolated environment for each test file
  • 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:

bash
npm init ava

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

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

Or if you prefer using Yarn:

bash
yarn add ava --dev

Alternatively you can install ava manually:

bash
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.

javascript
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

bash
npm test

Or with npx:

bash
npx ava

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

bash
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:

  • 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
  • TypeScript
  • Shared workers
  • Watch mode
  • When to use t.plan()
  • Passing arguments to your test files
  • Splitting tests in CI
  • Code coverage
  • Endpoint testing
  • Browser testing
  • Testing Vue.js components
  • Debugging tests with Chrome DevTools
  • Debugging tests with VSCode
  • Debugging tests with WebStorm
  • Isolated MongoDB integration tests
  • Testing web apps using Puppeteer
  • Testing web apps using Selenium WebDriverJS

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

  • GitHub Discussions

Related

  • eslint-plugin-ava — Lint rules for AVA tests
  • @ava/typescript — Test TypeScript projects
  • @ava/cooperate — Low-level primitives to enable cooperation between test files
  • @ava/get-port — Reserve a port while testing

Links

  • AVA stickers, t-shirts, etc
  • Awesome list
  • Do you like AVA? Donate here!
  • More…

Team

| ---|--- Mark Wubben | Sindre Sorhus

Former
  • Kevin Mårtensson
  • James Talmage
  • Juan Soto
  • Jeroen Engels
  • Vadim Demedes

Issues· 82 open

View all issuesOpen on GitHub
  • #3482

    (High Severity Concurrency Bug): Double Teardown (`t.teardown()`) Invocation on Test Timeout or Inactivity

    needs triageUpdated Sep 29, 2026
  • #3483

    (High Severity Uncaught TypeError): Unhandled Exception in `serializeError` on Anonymous or Eval Stack Frames

    needs triageUpdated Sep 28, 2026
  • #3479

    this.value[Symbol.iterator] is not a function

    needs triageUpdated Sep 28, 2026
  • #3326

    Tap reporter outputs internal stack traces

    needs triageUpdated Sep 26, 2026
  • #3484

    (High Severity Cross-Platform Bug): Windows Test Discovery Failure via Case-Sensitive Prefix Matching in `normalizeFileForMatching`

    needs triageUpdated Sep 15, 2026
  • #3481

    (Critical Architecture Bug): Shared Worker Plugin Crash & Test Worker Collision when `workerThreads: false`

    needs triageUpdated Sep 15, 2026
  • #3025

    Print useful message when worker threads cannot be used due to Node.js flags

    enhancementhelp wantedscope:reportersscope:test-environmentUpdated Aug 27, 2026
  • #2608

    Produce JSON reports

    scope:reportersUpdated Aug 26, 2026
  • #928

    Make it easier to write reliable cleanup tasks

    enhancementhelp wantedscope:test-interface:dollar: Funded on IssuehuntUpdated Jul 14, 2026
  • #2501

    Known reporter issues

    bughelp wantedscope:reporters:dollar: Funded on IssuehuntUpdated Jul 4, 2026

> Tags

JavaScriptassertasyncasync-functionsava

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 1, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库