Skip to content

Commit

Permalink
Readme: explain how to debug (fixes #1112) (#1116)
Browse files Browse the repository at this point in the history
  • Loading branch information
mightyiam authored and sindresorhus committed Nov 20, 2016
1 parent e02bd64 commit bee4a59
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -169,6 +170,20 @@ 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

AVA runs tests in child processes, so to debug tests, you need to do this workaround:

```console
$ node --inspect node_modules/ava/profile.js some/test/file.js
```

### Debugger-specific tips

- [WebStorm](docs/recipes/debugging-with-webstorm.md)


## Reporters

### Mini-reporter
Expand Down Expand Up @@ -972,14 +987,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.
Expand Down

0 comments on commit bee4a59

Please sign in to comment.