Skip to content

Commit

Permalink
Update ES modules recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
novemberborn committed May 28, 2018
1 parent 4365c8a commit e04c3c7
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion docs/recipes/es-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,43 @@ test('2 + 2 = 4', t => {
});
```

Note that test files still need to use the `.js` extension.
You need to configure AVA to recognize `.mjs` extensions. If you want AVA to apply its Babel presets use:

```json
{
"ava": {
"babel": {
"extensions": [
"js",
"mjs"
]
}
}
}
```

Alternatively you can use:

```json
{
"ava": {
"babel": false,
"extensions": [
"js",
"mjs"
]
}
}
```

Or leave Babel enabled (which means it's applied to `.js` files), but don't apply it to `.mjs` files:

```json
{
"ava": {
"extensions": [
"mjs"
]
}
}
```

0 comments on commit e04c3c7

Please sign in to comment.