-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Readme: explain how to debug (fixes #1112) #1116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ Translations: [Espa帽ol](https://github.com/avajs/ava-docs/blob/master/es_ES/rea | |
|
|
||
| - [Usage](#usage) | ||
| - [CLI Usage](#cli) | ||
| - [Debugging](#debugging) | ||
| - [Reporters](#reporters) | ||
| - [Configuration](#configuration) | ||
| - [Documentation](#documentation) | ||
|
|
@@ -169,6 +170,22 @@ Directories are recursed, with all `*.js` files being treated as test files. Dir | |
|
|
||
| When using `npm test`, you can pass positional arguments directly `npm test test2.js`, but flags needs to be passed like `npm test -- --verbose`. | ||
|
|
||
| ## Debugging | ||
|
|
||
| The AVA CLI runs tests in child processes. | ||
| Thus to debug one must bypass it: | ||
|
|
||
| ``` console | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove space |
||
| $ node --inspect node_modules/ava/profile.js some/test/file.js | ||
| ``` | ||
|
|
||
| In the future this bypass may not be required; | ||
| See #874. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Put it on the previous line. |
||
|
|
||
| ### Debugger-Specific Tips | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't titleize |
||
|
|
||
| * [WebStorm](docs/recipes/debugging-with-webstorm.md) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| ## Reporters | ||
|
|
||
| ### Mini-reporter | ||
|
|
@@ -972,14 +989,6 @@ Running tests concurrently comes with some challenges, doing file IO is one. | |
|
|
||
| Usually, serial tests create temp directories in the current test directory and clean them up at the end. This won't work when you run tests concurrently as tests will conflict with each other. The correct way to do it is to use a new temp directory for each test. The [`tempfile`](https://github.com/sindresorhus/tempfile) and [`temp-write`](https://github.com/sindresorhus/temp-write) modules can be helpful. | ||
|
|
||
| ### Debugging | ||
|
|
||
| AVA runs tests concurrently by default, which is suboptimal when you need to debug something. Instead, run tests serially with the `--serial` option: | ||
|
|
||
| ```console | ||
| $ ava --serial | ||
| ``` | ||
|
|
||
| ### Code coverage | ||
|
|
||
| You can't use [`istanbul`](https://github.com/gotwarlost/istanbul) for code coverage as AVA [spawns the test files](#process-isolation). You can use [`nyc`](https://github.com/bcoe/nyc) instead, which is basically `istanbul` with support for subprocesses. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.