diff --git a/docs/08-common-pitfalls.md b/docs/08-common-pitfalls.md index 068ef3237..92e4705da 100644 --- a/docs/08-common-pitfalls.md +++ b/docs/08-common-pitfalls.md @@ -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). diff --git a/docs/recipes/browser-testing.md b/docs/recipes/browser-testing.md index c30b94faf..60e061623 100644 --- a/docs/recipes/browser-testing.md +++ b/docs/recipes/browser-testing.md @@ -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'; @@ -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" ] } } diff --git a/docs/recipes/puppeteer.md b/docs/recipes/puppeteer.md index d96f6a7a4..bafc6e9ba 100644 --- a/docs/recipes/puppeteer.md +++ b/docs/recipes/puppeteer.md @@ -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'; @@ -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'; diff --git a/docs/recipes/vue.md b/docs/recipes/vue.md index e74f78356..eb8d31244 100644 --- a/docs/recipes/vue.md +++ b/docs/recipes/vue.md @@ -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')();