# Is ava ESM-only? Can you require() it?

> ava@8.0.1 is ESM-only. ESM-only since 8.0.0 — last CommonJS version is 7.0.0.

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

Last verified Sep 9, 2026 against ava@8.0.1.

ava dropped its CommonJS build in 8.0.0 (April 2026). The last version with a plain require()-able CommonJS entry is 7.0.0, published Feb 27, 2026; it declares support for Node.js ^20.19 || ^22.20 || ^24.12 || >=25.

require("ava") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it. Node.js 18 has no require(esm), and ava@8.0.1 declares Node.js ^22.20 || ^24.12 || >=26, so 18 is outside its supported range anyway.

ava@8.0.1 declares engines "^22.20 || ^24.12 || >=26", so Node.js 18, 20 are outside its supported range regardless of module format.

## What to do

1. require("ava") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it.
2. From a CommonJS file, use a dynamic import inside an async function: const ava = await import("ava"). That works on every Node.js version the package supports (^22.20 || ^24.12 || >=26).
3. If you need a synchronous require(): npm install ava@7.0.0, the last CommonJS release (published Feb 27, 2026); it declares Node.js ^20.19 || ^22.20 || ^24.12 || >=25.
4. ava@8.0.1 declares engines "^22.20 || ^24.12 || >=26", so Node.js 18, 20 are unsupported regardless: upgrade Node.js or pin an older release.
5. TypeScript: types are bundled; install nothing extra.

## Facts

- Latest: 8.0.1 (May 17, 2026)
- Module format: ESM-only
- Last CommonJS version: 7.0.0
- ESM-only since: 8.0.0 (Apr 27, 2026)
- TypeScript types: bundled
- Node engines: ^22.20 || ^24.12 || >=26
- Weekly downloads: 476K
- License: MIT

## Runtime test results for ava@8.0.1

Installed and executed on Sep 9, 2026 with require("ava") from a CommonJS file and import "ava" from an ES module.

| Runtime | require("ava") | import "ava" |
|---|---|---|
| Node.js 18 | fails (ERR_REQUIRE_ESM) | fails (Error) |
| Node.js 20 | fails (Error) | fails (Error) |
| Node.js 22 | fails (Error) | fails (Error) |
| Node.js 24 | fails (Error) | fails (Error) |
| Node.js 26 | fails (Error) | fails (Error) |
| Bun 1.4.0 | fails (Error) | fails (Error) |

## How to import ava

ES modules:

```js
import * as ava from "ava";
```

Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.

CommonJS:

```js
// require("ava") failed in our probe on Node.js 22.12+ and newer as well (The ‘ava’ module can only be imported in test files); see the runtime table.

// Any Node.js version the package supports (^22.20 || ^24.12 || >=26), from an async function:
async function main() {
  const ava = await import("ava");
}

// Or pin the last CommonJS release (declares Node.js ^20.19 || ^22.20 || ^24.12 || >=25):
// npm install ava@7.0.0
```

## Module format by version

Derived from the type, main and exports fields of every stable release on npm (102 versions; the newest 60 shown).

| Versions | Format | First published |
|---|---|---|
| 8.0.0 – 8.0.1 | ESM-only | Apr 27, 2026 |
| 4.0.0 – 7.0.0 | Dual (CommonJS + ESM) | Jan 3, 2022 |
| 1.3.1 – 3.15.0 | CommonJS | Mar 5, 2019 |

## Frequently asked

**Is ava ESM-only?**

ava@8.0.1 is ESM-only. ava dropped its CommonJS build in 8.0.0 (April 2026). The last version with a plain require()-able CommonJS entry is 7.0.0, published Feb 27, 2026; it declares support for Node.js ^20.19 || ^22.20 || ^24.12 || >=25.

**Which version of ava still supports CommonJS / require()?**

7.0.0 is the last version of ava with a CommonJS build; it declares Node.js ^20.19 || ^22.20 || ^24.12 || >=25. Install it with "npm install ava@7.0.0". Every version from 8.0.0 on is ESM-only.

**How do I use ava from a CommonJS file?**

From a CommonJS file, use a dynamic import inside an async function: const ava = await import("ava"). That works on every Node.js version the package supports (^22.20 || ^24.12 || >=26). require("ava") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it. Alternatively pin ava@7.0.0 (declares Node.js ^20.19 || ^22.20 || ^24.12 || >=25).

**Does ava work in Bun?**

Importing ava failed in Bun 1.4.0 on Sep 9, 2026: Test files must be run with the AVA CLI:

**Does ava ship TypeScript types?**

Yes. ava bundles its own type declarations; no @types package is needed.

## Links

- [ava on npm](https://www.npmjs.com/package/ava)
- [Source repository](https://github.com/avajs/ava)
- [HTML version](https://canirequire.com/package/ava/)
- [JSON version](https://canirequire.com/package/ava.json)

---

For scripts and AI agents: any package is at https://canirequire.com/package/<name>/index.md (Markdown) or https://canirequire.com/package/<name>.json (JSON); the site index is https://canirequire.com/llms.txt. Fetch the URL directly; no search needed.
