Skip to content

Commit a82fee5

Browse files
authored
Documentation updates
* Fix links between the various pages * Remove outdated recipe on precompiling with webpack * Update Babel documentation to remove bias towards .babelrc files. Fixes #1816.
1 parent afe028a commit a82fee5

File tree

8 files changed

+15
-288
lines changed

8 files changed

+15
-288
lines changed

docs/08-common-pitfalls.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ AVA currently only transpiles the tests you ask it to run, as well as test helpe
1212

1313
If you use Babel you can use its [require hook](https://babeljs.io/docs/usage/require/) to transpile imported modules on-the-fly. To add it, [configure it in your `package.json`](./06-configuration.md).
1414

15-
You can also transpile your modules in a separate process and refer to the transpiled files rather than the sources from your tests. Example [here](./recipes/precompiling-with-webpack.md).
15+
You can also transpile your modules in a separate process and refer to the transpiled files rather than the sources from your tests.
1616

1717
## AVA in Docker
1818

@@ -49,7 +49,7 @@ test('fetches foo', async t => {
4949
});
5050
```
5151

52-
If you're using callbacks, use [`test.cb`](https://github.com/avajs/ava#callback-support):
52+
If you're using callbacks, use [`test.cb`](./01-writing-tests.md#callback-support):
5353

5454
```js
5555
test.cb('fetches foo', t => {

docs/recipes/babel.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ You can override the default Babel configuration AVA uses for test file compilat
2727
}
2828
```
2929

30-
All `.babelrc` options are allowed inside the `testOptions` object.
30+
All [Babel options] are allowed inside the `testOptions` object.
3131

3232
## Reset AVA's cache
3333

@@ -60,7 +60,7 @@ See also AVA's [`extensions` option](../06-configuration.md#options).
6060

6161
## Make AVA skip your project's Babel options
6262

63-
You may not want AVA to use your project's Babel options, for example if your project is relying on Babel 6. You can set the `babelrc` option to `false`.
63+
You may not want AVA to use your project's Babel options, for example if your project is relying on Babel 6. Set the `babelrc` and `configFile` options to `false`.
6464

6565
**`package.json`:**
6666

@@ -69,7 +69,8 @@ You may not want AVA to use your project's Babel options, for example if your pr
6969
"ava": {
7070
"babel": {
7171
"testOptions": {
72-
"babelrc": false
72+
"babelrc": false,
73+
"configFile": false
7374
}
7475
}
7576
}
@@ -120,8 +121,6 @@ By default AVA's stage-4 preset will convert ES module syntax to CommonJS. This
120121
}
121122
```
122123

123-
You **must** configure the preset in the `testOptions` in order to preserve the ES module syntax. AVA will still apply the preset if you configure it in other files (for instance a `.babelrc` file). This is [due to a Babel issue](https://github.com/babel/babel/issues/7920).
124-
125124
You'll have to use the [`esm`](https://github.com/standard-things/esm) module so that AVA can still load your test files. [See our recipe for details](./es-modules.md).
126125

127126
## Disable AVA's Babel pipeline
@@ -206,3 +205,6 @@ Now instead of requiring `@babel/register`, require `test/_register` instead.
206205
```
207206

208207
Note that loading `@babel/register` in every worker process has a non-trivial performance cost. If you have lots of test files, you may want to consider using a build step to compile your sources *before* running your tests. This isn't ideal, since it complicates using AVA's watch mode, so we recommend using `@babel/register` until the performance penalty becomes too great. Setting up a precompilation step is out of scope for this document, but we recommend you check out one of the many [build systems that support Babel](http://babeljs.io/docs/setup/). There is an [issue](https://github.com/avajs/ava/issues/577) discussing ways we could make this experience better.
208+
209+
210+
[Babel options]: https://babeljs.io/docs/en/options

docs/recipes/flow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ test(async (t) => {
4141
});
4242
```
4343

44-
## Typing [`t.context`](https://github.com/avajs/ava#test-context)
44+
## Typing [`t.context`](../01-writing-tests.md#test-context)
4545

4646
By default, the type of `t.context` will be the empty object (`{}`). AVA exposes an interface `TestInterface<Context>` which you can use to apply your own type to `t.context`. This can help you catch errors at compile-time:
4747

docs/recipes/jspm-systemjs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This recipe has only been tested with JSPM v0.17.0-beta.22, but it should work w
1010

1111
### Babel
1212

13-
Configure your .babelrc to work with AVA if you have not already. NOTE: You can keep additional configuration in your JSPM config files to override these settings during bundling and building.
13+
Set up your Babel options to work with AVA if you have not already. NOTE: You can keep additional configuration in your JSPM config files to override these settings during bundling and building.
1414

1515
```
1616
$ npm install --save-dev @babel/preset-env

docs/recipes/precompiling-with-webpack.md

Lines changed: 0 additions & 274 deletions
This file was deleted.

docs/recipes/typescript.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ test(async t => {
5656
});
5757
```
5858

59-
## Using [macros](https://github.com/avajs/ava#test-macros)
59+
## Using [macros](../01-writing-tests.md#reusing-test-logic-through-macros)
6060

6161
In order to be able to assign the `title` property to a macro you need to type the function:
6262

@@ -86,7 +86,7 @@ const macro: CbMacro = t => {
8686
test.cb(macro);
8787
```
8888

89-
## Typing [`t.context`](https://github.com/avajs/ava#test-context)
89+
## Typing [`t.context`](../01-writing-tests.md#test-context)
9090

9191
By default, the type of `t.context` will be the empty object (`{}`). AVA exposes an interface `TestInterface<Context>` which you can use to apply your own type to `t.context`. This can help you catch errors at compile-time:
9292

docs/recipes/watch-mode.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,5 +119,5 @@ Watch mode is relatively new and there might be some rough edges. Please [report
119119
[`chokidar`]: https://github.com/paulmillr/chokidar
120120
[Install Troubleshooting]: https://github.com/paulmillr/chokidar#install-troubleshooting
121121
[`ignore-by-default`]: https://github.com/novemberborn/ignore-by-default
122-
[`.only` modifier]: https://github.com/avajs/ava#running-specific-tests
123-
[config]: https://github.com/avajs/ava#configuration
122+
[`.only` modifier]: ../01-writing-tests.md#running-specific-tests
123+
[config]: ../06-configuration.md

readme.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ We have a growing list of [common pitfalls](docs/08-common-pitfalls.md) you may
172172
- [JSPM and SystemJS](docs/recipes/jspm-systemjs.md)
173173
- [Debugging tests with Chrome DevTools](docs/recipes/debugging-with-chrome-devtools.md)
174174
- [Debugging tests with WebStorm](docs/recipes/debugging-with-webstorm.md)
175-
- [Precompiling source files with webpack](docs/recipes/precompiling-with-webpack.md)
176175
- [Isolated MongoDB integration tests](docs/recipes/isolated-mongodb-integration-tests.md)
177176
- [Testing web apps using Puppeteer](docs/recipes/puppeteer.md)
178177

0 commit comments

Comments
 (0)