Skip to content
Permalink
Browse files

Remove built-in Babel support

This updates code and tests to remove built-in Babel support. In the
future, it needs to be opted in to, and @ava/babel needs to be installed
besides AVA itself.

Our tests have become quite muddled, and some of them require Babel to
still be enabled, but that's all OK for now.

* Remove outdated JSPM recipe

* Update documentation to reflect the removal of built-in Babel

* Move responsibility for power-assert to @ava/babel
  • Loading branch information
novemberborn committed Dec 24, 2019
1 parent 4953457 commit b4ea43529a6d058a96055735cfa6e7056c009112
Showing with 812 additions and 2,321 deletions.
  1. +0 βˆ’1 contributing.md
  2. +1 βˆ’1 docs/01-writing-tests.md
  3. +1 βˆ’1 docs/03-assertions.md
  4. +7 βˆ’1 docs/05-command-line.md
  5. +7 βˆ’17 docs/06-configuration.md
  6. +2 βˆ’8 docs/08-common-pitfalls.md
  7. +4 βˆ’271 docs/recipes/babel.md
  8. +0 βˆ’5 docs/recipes/babelrc.md
  9. +4 βˆ’7 docs/recipes/code-coverage.md
  10. +1 βˆ’31 docs/recipes/es-modules.md
  11. +2 βˆ’2 docs/recipes/flow.md
  12. +0 βˆ’67 docs/recipes/jspm-systemjs.md
  13. +2 βˆ’2 docs/recipes/react.md
  14. +1 βˆ’1 docs/recipes/vue.md
  15. +4 βˆ’5 eslint-plugin-helper.js
  16. +9 βˆ’44 lib/api.js
  17. +35 βˆ’16 lib/assert.js
  18. +11 βˆ’49 lib/babel-manager.js
  19. +5 βˆ’6 lib/cli.js
  20. +0 βˆ’23 lib/enhance-assert.js
  21. +6 βˆ’54 lib/extensions.js
  22. +1 βˆ’1 lib/load-config.js
  23. +3 βˆ’0 lib/runner.js
  24. +3 βˆ’1 lib/test.js
  25. +10 βˆ’2 lib/worker/subprocess.js
  26. +501 βˆ’143 package-lock.json
  27. +2 βˆ’5 package.json
  28. +2 βˆ’14 readme.md
  29. +0 βˆ’1 stage-4.js
  30. +12 βˆ’521 test/api.js
  31. +0 βˆ’13 test/fixture/async-await.js
  32. +1 βˆ’1 test/fixture/ava-paths/target/test.js
  33. +0 βˆ’3 test/fixture/babel-config/.alt-babelrc
  34. +0 βˆ’11 test/fixture/babel-config/babel.config.js
  35. +0 βˆ’4 test/fixture/babel-config/package.json
  36. +0 βˆ’11 test/fixture/babel-config/test.js
  37. +0 βˆ’1 test/fixture/babel-hook-imported.js
  38. +0 βˆ’1 test/fixture/babel-hook.js
  39. +0 βˆ’1 test/fixture/babel-noop-plugin-or-preset.js
  40. +0 βˆ’22 test/fixture/babel-plugin-foo-to-bar.js
  41. +0 βˆ’22 test/fixture/babel-plugin-test-capitalizer.js
  42. +0 βˆ’49 test/fixture/babel-plugin-test-doubler.js
  43. +0 βˆ’7 test/fixture/babelrc-js/.babelrc.js
  44. +0 βˆ’4 test/fixture/babelrc-js/package.json
  45. +0 βˆ’11 test/fixture/babelrc-js/test.js
  46. +0 βˆ’3 test/fixture/babelrc/.alt-babelrc
  47. +0 βˆ’11 test/fixture/babelrc/.babelrc
  48. +0 βˆ’3 test/fixture/babelrc/disable-stage-4.babelrc
  49. +0 βˆ’4 test/fixture/babelrc/package.json
  50. +0 βˆ’11 test/fixture/babelrc/test.js
  51. +1 βˆ’1 test/fixture/caching/test.js
  52. +1 βˆ’1 test/fixture/concurrency/test.js
  53. +0 βˆ’1 test/fixture/correct-sources-in-source-map/package.json
  54. +0 βˆ’3 test/fixture/correct-sources-in-source-map/test/path-to/the/test-file.js
  55. +1 βˆ’1 test/fixture/enhanced-assertion-formatting.js
  56. +2 βˆ’2 test/fixture/environment-variables/test.js
  57. +1 βˆ’1 test/fixture/error-in-anonymous-function.js
  58. +0 βˆ’8 test/fixture/es2015-source-maps.js
  59. +1 βˆ’1 test/fixture/es2015.js
  60. +0 βˆ’1 test/fixture/eslint-plugin-helper/ava.config.js
  61. +1 βˆ’1 test/fixture/extensions/test.foo.bar
  62. +1 βˆ’1 test/fixture/fail-fast/crash/crashes.js
  63. +1 βˆ’1 test/fixture/fail-fast/crash/passes.js
  64. +1 βˆ’1 test/fixture/fail-fast/multiple-files/fails.js
  65. +1 βˆ’1 test/fixture/fail-fast/multiple-files/passes-slow.js
  66. +1 βˆ’1 test/fixture/fail-fast/multiple-files/passes.js
  67. +1 βˆ’1 test/fixture/fail-fast/single-file/test.js
  68. +1 βˆ’1 test/fixture/fail-fast/timeout/fails.js
  69. +1 βˆ’1 test/fixture/fail-fast/timeout/passes.js
  70. +1 βˆ’1 test/fixture/fail-fast/without-error/a.js
  71. +1 βˆ’1 test/fixture/fail-fast/without-error/b.js
  72. +1 βˆ’1 test/fixture/formatting-color.js
  73. +0 βˆ’336 test/fixture/formatting.js
  74. +1 βˆ’1 test/fixture/hooks-skipped.js
  75. +1 βˆ’1 test/fixture/ignored-dirs/helpers/test.js
  76. +1 βˆ’1 test/fixture/ignored-dirs/test.js
  77. +1 βˆ’1 test/fixture/improper-t-throws/async-callback.js
  78. +1 βˆ’1 test/fixture/improper-t-throws/caught-and-leaked-slowly.js
  79. +1 βˆ’1 test/fixture/improper-t-throws/caught-and-leaked-too-slowly.js
  80. +1 βˆ’1 test/fixture/improper-t-throws/caught-and-leaked.js
  81. +1 βˆ’1 test/fixture/improper-t-throws/caught.js
  82. +1 βˆ’1 test/fixture/improper-t-throws/leaked-from-promise.js
  83. +5 βˆ’0 test/fixture/improper-t-throws/package.json
  84. +1 βˆ’1 test/fixture/improper-t-throws/promise.js
  85. +1 βˆ’1 test/fixture/improper-t-throws/throws.js
  86. +1 βˆ’1 test/fixture/improper-t-throws/unhandled-rejection.js
  87. +1 βˆ’1 test/fixture/infinity-stack-trace.js
  88. +0 βˆ’5 test/fixture/inspect-arg.js
  89. +0 βˆ’7 test/fixture/invalid-extensions/babel-duplicates/package.json
  90. +0 βˆ’1 test/fixture/invalid-extensions/top-level-duplicates/package.json
  91. +0 βˆ’1 test/fixture/just-enhancement-compilation/_helper.js
  92. +0 βˆ’5 test/fixture/just-enhancement-compilation/custom-extension/package.json
  93. +0 βˆ’8 test/fixture/just-enhancement-compilation/custom-extension/power-assert.foo
  94. 0 test/fixture/just-enhancement-compilation/dependency.js
  95. +0 βˆ’1 test/fixture/just-enhancement-compilation/import.js
  96. +0 βˆ’6 test/fixture/just-enhancement-compilation/package.json
  97. +0 βˆ’8 test/fixture/just-enhancement-compilation/power-assert.js
  98. +1 βˆ’1 test/fixture/long-running.js
  99. +2 βˆ’2 test/fixture/long-stack-trace/test.js
  100. +1 βˆ’1 test/fixture/match-no-match-2.js
  101. +1 βˆ’1 test/fixture/match-no-match.js
  102. +1 βˆ’1 test/fixture/matcher-skip.js
  103. +1 βˆ’1 test/fixture/meta.js
  104. +0 βˆ’1 test/fixture/no-babel-compilation/_helper.js
  105. 0 test/fixture/no-babel-compilation/dependency.js
  106. +0 βˆ’1 test/fixture/no-babel-compilation/import.js
  107. +0 βˆ’8 test/fixture/no-babel-compilation/no-power-assert.js
  108. +0 βˆ’6 test/fixture/no-babel-compilation/package.json
  109. +0 βˆ’7 test/fixture/no-babel-compilation/require-helper.js
  110. 0 test/fixture/no-babel-config/.gitkeep
  111. +1 βˆ’1 test/fixture/no-tests.js
  112. +2 βˆ’2 test/fixture/node-assertions/assert-failure.js
  113. +1 βˆ’1 test/fixture/node-env-foo.js
  114. +1 βˆ’1 test/fixture/node-env-test.js
  115. +3 βˆ’3 test/fixture/node-paths.js
  116. +0 βˆ’9 test/fixture/one-pass-one-fail.js
  117. +1 βˆ’1 test/fixture/parallel-runs/10.js
  118. +1 βˆ’1 test/fixture/parallel-runs/2.js
  119. +1 βˆ’1 test/fixture/parallel-runs/2a.js
  120. +1 βˆ’1 test/fixture/parallel-runs/9.js
  121. +1 βˆ’1 test/fixture/parallel-runs/Ab.js
  122. +1 βˆ’1 test/fixture/parallel-runs/a.js
  123. +1 βˆ’1 test/fixture/parallel-runs/b.js
  124. +1 βˆ’1 test/fixture/parallel-runs/c.js
  125. +1 βˆ’1 test/fixture/pkg-conf/fail-without-assertions/test.js
  126. +1 βˆ’1 test/fixture/pkg-conf/resolve-dir/dir-a-wrapper/dir-a/dir-a-wrapper-3.js
  127. +1 βˆ’1 test/fixture/pkg-conf/resolve-dir/dir-a-wrapper/dir-a/dir-a-wrapper-4.js
  128. +1 βˆ’1 test/fixture/pkg-conf/resolve-dir/dir-a/dir-a-base-1.js
  129. +1 βˆ’1 test/fixture/pkg-conf/resolve-dir/dir-a/dir-a-base-2.js
  130. +0 βˆ’19 test/fixture/power-assert.js
  131. +0 βˆ’1 test/fixture/precompile-helpers/test/_b.js
  132. +0 βˆ’1 test/fixture/precompile-helpers/test/helpers/a.js
  133. +0 βˆ’10 test/fixture/precompile-helpers/test/test.js
  134. +3 βˆ’3 test/fixture/process-cwd-default.js
  135. +1 βˆ’1 test/fixture/process-cwd-pkgdir.js
  136. +1 βˆ’1 test/fixture/report/edge-cases/ava-import-no-test-declaration.js
  137. +1 βˆ’1 test/fixture/report/edge-cases/import-and-use-test-member.js
  138. +1 βˆ’1 test/fixture/report/failfast/a.js
  139. +1 βˆ’1 test/fixture/report/failfast/b.js
  140. +1 βˆ’1 test/fixture/report/failfast2/a.js
  141. +1 βˆ’1 test/fixture/report/failfast2/b.js
  142. +1 βˆ’1 test/fixture/report/only/a.js
  143. +1 βˆ’1 test/fixture/report/only/b.js
  144. +1 βˆ’1 test/fixture/report/regular/bad-test-chain.js
  145. +1 βˆ’1 test/fixture/report/regular/output-in-hook.js
  146. +1 βˆ’1 test/fixture/report/regular/slow.js
  147. +1 βˆ’1 test/fixture/report/regular/test.js
  148. +1 βˆ’1 test/fixture/report/regular/traces-in-t-throws.js
  149. +1 βˆ’1 test/fixture/report/regular/uncaught-exception.js
  150. +1 βˆ’1 test/fixture/report/regular/unhandled-rejection.js
  151. +1 βˆ’1 test/fixture/report/timeoutinmultiplefiles/a.js
  152. +1 βˆ’1 test/fixture/report/timeoutinmultiplefiles/b.js
  153. +1 βˆ’1 test/fixture/report/timeoutinsinglefile/a.js
  154. +1 βˆ’1 test/fixture/report/timeoutwithmatch/a.js
  155. +1 βˆ’1 test/fixture/report/watch/test.js
  156. +0 βˆ’1 test/fixture/require-compiled-helper/dependency.js
  157. +0 βˆ’7 test/fixture/require-compiled-helper/package.json
  158. +0 βˆ’3 test/fixture/require-compiled-helper/test/_helper.js
  159. +0 βˆ’5 test/fixture/require-compiled-helper/test/verify.js
  160. +1 βˆ’1 test/fixture/reset-cache/test.js
  161. +1 βˆ’1 test/fixture/serial.js
  162. +1 βˆ’1 test/fixture/skip-only.js
  163. +0 βˆ’31 test/fixture/slow-exit.js
  164. +1 βˆ’1 test/fixture/snapshots/__tests__-dir/__tests__/test.js
  165. +1 βˆ’1 test/fixture/snapshots/test-content/tests/test.js
  166. +1 βˆ’1 test/fixture/snapshots/test-dir/test/test.js
  167. +1 βˆ’1 test/fixture/snapshots/test-snapshot-location/src/feature/nested-feature/test.js
  168. +1 βˆ’1 test/fixture/snapshots/test-snapshot-location/src/feature/test.js
  169. +1 βˆ’1 test/fixture/snapshots/test-snapshot-location/src/test.js
  170. +2 βˆ’2 test/fixture/snapshots/test-sourcemaps/build/feature/__tests__/test.js
  171. +2 βˆ’2 test/fixture/snapshots/test-sourcemaps/build/test.js
  172. +2 βˆ’2 test/fixture/snapshots/test-sourcemaps/build/test/test.js
  173. +1 βˆ’1 test/fixture/snapshots/test-sourcemaps/src/feature/__tests__/test.ts
  174. +1 βˆ’1 test/fixture/snapshots/test-sourcemaps/src/test.ts
  175. +1 βˆ’1 test/fixture/snapshots/test-sourcemaps/src/test/test.ts
  176. +1 βˆ’1 test/fixture/snapshots/test.js
  177. +1 βˆ’1 test/fixture/snapshots/tests-dir/tests/test.js
  178. +1 βˆ’1 test/fixture/snapshots/watcher-rerun/test.js
  179. +1 βˆ’1 test/fixture/stalled-tests/callback.js
  180. +2 βˆ’2 test/fixture/stalled-tests/observable.js
  181. +1 βˆ’1 test/fixture/stalled-tests/promise.js
  182. +0 βˆ’5 test/fixture/subdir/failing-subdir.js
  183. +0 βˆ’5 test/fixture/subdir/in-a-subdir.js
  184. +0 βˆ’5 test/fixture/subdir/nested/nested.js
  185. +1 βˆ’1 test/fixture/symlinkdir/symlink.js
  186. +1 βˆ’1 test/fixture/target-symlink.js
  187. +1 βˆ’1 test/fixture/test-count-2.js
  188. +1 βˆ’1 test/fixture/test-count-3.js
  189. +1 βˆ’1 test/fixture/test-count.js
  190. +0 βˆ’22 test/fixture/trigger-worker-exception/hack.js
  191. +0 βˆ’8 test/fixture/trigger-worker-exception/package.json
  192. +0 βˆ’5 test/fixture/trigger-worker-exception/test-fallback.js
  193. +0 βˆ’9 test/fixture/trigger-worker-exception/test.js
  194. +0 βˆ’1 test/fixture/ts-node/package.json
  195. +1 βˆ’1 test/fixture/ts-node/test.ts
  196. +2 βˆ’2 test/fixture/tty/callbacks.js
  197. +1 βˆ’1 test/fixture/tty/color-disabled.js
  198. +1 βˆ’1 test/fixture/tty/color-enabled.js
  199. +1 βˆ’1 test/fixture/tty/get-color-depth-missing.js
  200. +1 βˆ’1 test/fixture/tty/is-not-tty.js
  201. +1 βˆ’1 test/fixture/tty/is-tty.js
  202. +1 βˆ’1 test/fixture/validate-installed-global.js
  203. +1 βˆ’1 test/fixture/watcher/custom-extensions/test.foo
  204. +1 βˆ’1 test/fixture/watcher/ignored-files/test.js
  205. +1 βˆ’1 test/fixture/watcher/tap-in-conf/test.js
  206. +1 βˆ’1 test/fixture/watcher/test.js
  207. +2 βˆ’2 test/fixture/watcher/with-custom-ext-dependencies/test-1.js
  208. +1 βˆ’1 test/fixture/watcher/with-custom-ext-dependencies/test-2.js
  209. +2 βˆ’2 test/fixture/watcher/with-dependencies/test-1.js
  210. +1 βˆ’1 test/fixture/watcher/with-dependencies/test-2.js
  211. +3 βˆ’3 test/fixture/with-dependencies/no-tests.js
  212. +4 βˆ’4 test/fixture/with-dependencies/test-failure.js
  213. +4 βˆ’4 test/fixture/with-dependencies/test-uncaught-exception.js
  214. +4 βˆ’4 test/fixture/with-dependencies/test.js
  215. +1 βˆ’1 test/fixture/worker-argv.js
  216. +2 βˆ’5 test/helper/report.js
  217. +7 βˆ’8 test/integration/assorted.js
  218. +0 βˆ’79 test/integration/compilation.js
  219. +1 βˆ’1 test/integration/config.js
  220. +0 βˆ’14 test/integration/extensions.js
  221. +1 βˆ’1 test/integration/snapshots.js
  222. +1 βˆ’1 test/reporters/mini.edgecases.log
  223. +1 βˆ’1 test/reporters/mini.regular.log
  224. +3 βˆ’3 test/reporters/tap.edgecases.log
  225. +3 βˆ’3 test/reporters/tap.regular.log
  226. +1 βˆ’1 test/reporters/verbose.edgecases.log
  227. +1 βˆ’1 test/reporters/verbose.regular.log
@@ -28,7 +28,6 @@ The [`question` label](https://github.com/avajs/ava/labels/question) is a good p

You can use issue labels to discover issues you could help out with:

* [`babel` issues](https://github.com/avajs/ava/labels/babel) relate to our Babel infrastructure
* [`blocked` issues](https://github.com/avajs/ava/labels/blocked) need help getting unstuck
* [`bug` issues](https://github.com/avajs/ava/labels/bug) are known bugs we'd like to fix
* [`enhancement` issues](https://github.com/avajs/ava/labels/enhancement) are features we're open to including
@@ -12,7 +12,7 @@ AVA tries to run test files with their current working directory set to the dire

Each test file is run in a separate Node.js process. This allows you to change the global state or overriding a built-in in one test file, without affecting another. It's also great for performance on modern multi-core processors, allowing multiple test files to execute in parallel.

AVA will set `process.env.NODE_ENV` to `test`, unless the `NODE_ENV` environment variable has been set. This is useful if the code you're testing has test defaults (for example when picking what database to connect to, or environment-specific Babel options). It may cause your code or its dependencies to behave differently though. Note that `'NODE_ENV' in process.env` will always be `true`.
AVA will set `process.env.NODE_ENV` to `test`, unless the `NODE_ENV` environment variable has been set. This is useful if the code you're testing has test defaults (for example when picking what database to connect to). It may cause your code or its dependencies to behave differently though. Note that `'NODE_ENV' in process.env` will always be `true`.

## Declaring tests

@@ -84,7 +84,7 @@ test('skip assertion', t => {

## Enhanced assertion messages

AVA comes with [`power-assert`](https://github.com/power-assert-js/power-assert) built-in, giving you more descriptive assertion messages.
Enabling [Babel](./recipes/babel.md) will also enable [`power-assert`](https://github.com/power-assert-js/power-assert), giving you more descriptive assertion messages.

Let's take this example, using Node's standard [`assert` library](https://nodejs.org/api/assert.html):

@@ -133,7 +133,13 @@ test(function foo(t) {

## Resetting AVA's cache

AVA caches the compiled test and helper files. It automatically recompiles these files when you change them. AVA tries its best to detect changes to your Babel configuration files, plugins and presets. If it seems like your latest Babel configuration isn't being applied, however, you can run AVA with the `--reset-cache` flag to reset AVA's cache. If set, all files in the `node_modules/.cache/ava` directory are deleted. Run AVA as normal to apply your new Babel configuration.
AVA may cache certain files, especially when you use our [`@ava/babel`](https://github.com/avajs/babel) provider. If it seems like your latest changes aren't being picked up by AVA you can reset the cache by running:

```console
npx ava reset-cache
```

This deletes all files in the `node_modules/.cache/ava` directory.

## Reporters

@@ -26,25 +26,16 @@ To ignore files, prefix the pattern with an `!` (exclamation mark).
"*oo",
"!foo"
],
"cache": true,
"concurrency": 5,
"failFast": true,
"failWithoutAssertions": false,
"environmentVariables": {
"MY_ENVIRONMENT_VARIABLE": "some value"
},
"tap": true,
"verbose": true,
"compileEnhancements": false,
"require": [
"@babel/register"
],
"babel": {
"extensions": ["js", "jsx"],
"testOptions": {
"babelrc": false
}
}
"./my-helper-module.js"
]
}
}
```
@@ -53,8 +44,8 @@ Arguments passed to the CLI will always take precedence over the CLI options con

## Options

- `files`: an array of glob patterns to select test files. Files with an underscore prefix are ignored. By default only selects files with `js` extensions, even if the pattern matches other files. Specify `extensions` and `babel.extensions` to allow other file extensions
- `helpers`: an array of glob patterns to select helper files. Files matched here are never considered as tests. By default only selects files with `js` extensions, even if the pattern matches other files. Specify `extensions` and `babel.extensions` to allow other file extensions
- `files`: an array of glob patterns to select test files. Files with an underscore prefix are ignored. By default only selects files with `js` extensions, even if the pattern matches other files. Specify `extensions` to allow other file extensions
- `helpers`: an array of glob patterns to select helper files. Files matched here are never considered as tests. By default only selects files with `js` extensions, even if the pattern matches other files. Specify `extensions` to allow other file extensions
- `sources`: an array of glob patterns to match files that, when changed, cause tests to be re-run (when in watch mode). See the [watch mode recipe for details](https://github.com/avajs/ava/blob/master/docs/recipes/watch-mode.md#source-files-and-test-files)
- `match`: not typically useful in the `package.json` configuration, but equivalent to [specifying `--match` on the CLI](./05-command-line.md#running-tests-with-matching-titles)
- `cache`: cache compiled test and helper files under `node_modules/.cache/ava`. If `false`, files are cached in a temporary directory instead
@@ -64,15 +55,14 @@ Arguments passed to the CLI will always take precedence over the CLI options con
- `tap`: if `true`, enables the [TAP reporter](./05-command-line.md#tap-reporter)
- `verbose`: if `true`, enables verbose output
- `snapshotDir`: specifies a fixed location for storing snapshot files. Use this if your snapshots are ending up in the wrong location
- `compileEnhancements`: if `false`, disables [`power-assert`](./03-assertions.md#enhanced-assertion-messages) β€” which otherwise helps provide more descriptive error messages β€” and detection of improper use of the `t.throws()` assertion
- `extensions`: extensions of test files that are not precompiled using AVA's Babel presets. Note that files are still compiled to enable `power-assert` and other features, so you may also need to set `compileEnhancements` to `false` if your files are not valid JavaScript. Setting this overrides the default `"js"` value, so make sure to include that extension in the list, as long as it's not included in `babel.extensions`
- `extensions`: extensions of test files. Setting this overrides the default `"js"` value, so make sure to include that extension in the list
- `require`: extra modules to require before tests are run. Modules are required in the [worker processes](./01-writing-tests.md#process-isolation)
- `babel`: test file specific Babel options. See our [Babel recipe](./recipes/babel.md#configuring-babel) for more details
- `babel.extensions`: extensions of test files that will be precompiled using AVA's Babel presets. Setting this overrides the default `"js"` value, so make sure to include that extension in the list
- `timeout`: Timeouts in AVA behave differently than in other test frameworks. AVA resets a timer after each test, forcing tests to quit if no new test results were received within the specified timeout. This can be used to handle stalled tests. See our [timeout documentation](./07-test-timeouts.md) for more options.

Note that providing files on the CLI overrides the `files` option.

Provide the `babel` option (and install [`@ava/babel`](https://github.com/avajs/babel) as an additional dependency) to enable Babel compilation.

## Using `ava.config.js`

To use an `ava.config.js` file:
@@ -4,14 +4,6 @@ Translations: [Français](https://github.com/avajs/ava-docs/blob/master/fr_FR/do

If you use [ESLint](http://eslint.org/), you can install [eslint-plugin-ava](https://github.com/avajs/eslint-plugin-ava). It will help you use AVA correctly and avoid some common pitfalls.

## Transpiling imported modules

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

You can also transpile your modules in a separate process and refer to the transpiled files rather than the sources from your tests.

## AVA in Docker

If you run AVA in Docker as part of your CI, you need to fix the appropriate environment variables. Specifically, adding `-e CI=true` in the `docker exec` command. See [#751](https://github.com/avajs/ava/issues/751).
@@ -81,6 +73,8 @@ test('one is one', t => {
});
```

Also make sure to enable [Babel](./recipes/babel.md).

## Sharing variables between asynchronous tests

By default AVA executes tests concurrently. This can cause problems if your tests are asynchronous and share variables.

0 comments on commit b4ea435

Please sign in to comment.
You can’t perform that action at this time.