File: coverage.md

package info (click to toggle)
node-uvu 0.5.6%2B~cs4.10.4-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,352 kB
  • sloc: javascript: 6,951; makefile: 10
file content (40 lines) | stat: -rw-r--r-- 986 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Coverage

Code coverage is not implemented by the [CLI](/docs/cli.md) directly.

Instead, `uvu` plays nicely with existing coverage tools like [`c8`](https://www.npmjs.com/package/c8) or [`nyc`](https://www.npmjs.com/package/nyc). <br>Please refer to their respective documentations for usage information.

## Examples

> Visit the working [`/examples/coverage`](/examples/coverage) demonstration~!

Assuming we have a `uvu` command hooked up to the `npm test` script:

```js
// package.json
{
  "scripts": {
    "test": "uvu tests --ignore fixtures"
  }
}
```

We can then use `nyc` or `c8` (or others) as a prefix to our `npm test` usage:

```sh
$ c8 npm test
$ nyc npm test

$ c8 yarn test
$ nyc yarn test

$ nyc --include=src npm test
$ c8 --all npm test
```

Of course, you can also use `c8`/`nyc` directly with `uvu` – it just makes it more confusing to distinguish CLI option flags:

```sh
$ c8 uvu tests --ignore fixtures
$ nyc --include=src uvu tests --ignore fixtures
```