Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/avaPublic

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

License

NotificationsYou must be signed in to change notification settings

avajs/ava

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 theDiscussions for updates.

Read ourcontributing 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

Yourpackage.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 installava manually:

npm install --save-dev ava

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

Don't forget to configure thetest script in yourpackage.json as per above.

Create your test file

Create a file namedtest.js in the project root directory.

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

importtestfrom'ava';test('foo',t=>{t.pass();});test('bar',asynct=>{constbar=Promise.resolve('bar');t.is(awaitbar,'bar');});

Running your tests

npm test

Or withnpx:

npx ava

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

npx ava --watch

Supported Node.js versions

AVA supports the latest release of any major version thatis supported by Node.js itself. Read more in oursupport 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 theci-parallel-vars package for a list of supported CI environments.

Documentation

Please see thefiles in thedocs directory:

Common pitfalls

We have a growing list ofcommon pitfalls you may experience while using AVA. If you encounter any issues you think are common, comment inthis 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 theAndromeda galaxy.

What is the difference between concurrency and parallelism?

Concurrency is not parallelism. It enables parallelism.

Support

Related

Links

Team

Mark WubbenSindre Sorhus
Mark WubbenSindre Sorhus
Former



AVA


[8]ページ先頭

©2009-2025 Movatter.jp