File: babel.md

package info (click to toggle)
node-ava 5.3.1%2Bdfsg%2B~cs46.3.10-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,636 kB
  • sloc: javascript: 19,247; sh: 9; makefile: 8
file content (21 lines) | stat: -rw-r--r-- 670 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Configuring Babel with AVA

Translations: [Français](https://github.com/avajs/ava-docs/blob/main/fr_FR/docs/recipes/babel.md)

You can enable Babel support by installing [`@babel/register`](https://babeljs.io/docs/en/babel-register) and `@babel/core`, and then in AVA's configuration requiring `@babel/register`:

**`package.json`:**

```json
{
	"ava": {
		"require": [
			"@babel/register"
		]
	}
}
```

`@babel/register` is compatible with CommonJS only. It intercepts `require()` calls and compiles files on the fly. This will compile source, helper and test files.

For more information visit the [Babel documentation](https://babeljs.io/docs/en/babel-register).