Skip to content

Commit

Permalink
Use underscore-prefixed helpers in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
novemberborn committed May 5, 2019
1 parent c2d8218 commit 91b7641
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/08-common-pitfalls.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ If you use [ESLint](http://eslint.org/), you can install [eslint-plugin-ava](htt

### Transpiling imported modules

AVA currently only transpiles the tests you ask it to run, as well as test helpers (files starting with `_` or in `helpers` directory) inside the test directory. *It will not transpile modules you `import` from outside of the test.* This may be unexpected but there are workarounds.
AVA currently only transpiles test and helper files. *It will not transpile modules you `import` from outside of the test.* This may be unexpected but there are workarounds.

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).

Expand Down
6 changes: 3 additions & 3 deletions docs/recipes/browser-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ $ npm install --save-dev browser-env

## Setup browser-env

Create a helper file and place it in the `test/helpers` folder. This ensures AVA does not treat it as a test.
Create a helper file, prefixed with an underscore. This ensures AVA does not treat it as a test.

`test/helpers/setup-browser-env.js`:
`test/_setup-browser-env.js`:

```js
import browserEnv from 'browser-env';
Expand Down Expand Up @@ -58,7 +58,7 @@ Configure AVA to `require` the helper before every test file.
{
"ava": {
"require": [
"./test/helpers/setup-browser-env.js"
"./test/_setup-browser-env.js"
]
}
}
Expand Down
4 changes: 2 additions & 2 deletions docs/recipes/puppeteer.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Translations: [Français](https://github.com/avajs/ava-docs/blob/master/fr_FR/do

The first step is setting up a helper to configure the environment:

`./test/helpers/withPage.js`
`./test/_withPage.js`

```js
import puppeteer from 'puppeteer';
Expand All @@ -33,7 +33,7 @@ export default async function withPage(t, run) {

```js
import test from 'ava';
import withPage from './helpers/withPage';
import withPage from './_withPage';

const url = 'https://google.com';

Expand Down
4 changes: 2 additions & 2 deletions docs/recipes/vue.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ The first step is setting up a helper to configure the environment to transpile
{
"ava": {
"require": [
"./test/helpers/setup.js"
"./test/_setup.js"
]
}
}
```

```js
// ./test/helpers/setup.js
// ./test/_setup.js

// Setup browser environment
require('browser-env')();
Expand Down

0 comments on commit 91b7641

Please sign in to comment.