Skip to content

Commit

Permalink
doc: new build-in reports
Browse files Browse the repository at this point in the history
  • Loading branch information
cenfun committed Jul 3, 2024
1 parent 6154e47 commit d9a461d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- performance improvement for comment parser (monocart-locator)
- added new build-in report: `markdown-summary` (coverage-summary.md)
- added new build-in report: `markdown-details` (coverage-details.md)
- added new option: `dataDir` alternative to method `addFromDir()`

- 2.8.7
- fixed OOM with better GC
Expand Down
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,27 @@ For more information, see [Command Line](#command-line)

> Other build-in reports (both V8 and Istanbul data):
- `codecov`
- coverage data for [Codecov](https://docs.codecov.com/docs/codecov-custom-coverage-format), see [example](https://app.codecov.io/github/cenfun/monocart-coverage-reports)
- `codecov` Save coverage data to a json file with [Codecov](https://docs.codecov.com/docs/codecov-custom-coverage-format) format (defaults to `codecov.json`), see [example](https://app.codecov.io/github/cenfun/monocart-coverage-reports).

- `codacy`
- coverage data for [Codacy](https://api.codacy.com/swagger#tocscoveragereport) API
- `codacy` Save coverage data to a json file with [Codacy API](https://api.codacy.com/swagger#tocscoveragereport) format (defaults to `codacy.json`).

- `console-summary` shows coverage summary in the console
- `console-summary` shows coverage summary in the console.

![](./assets/console-summary.png)

- `console-details` Show file coverage and uncovered lines in the console. Like `text`, but for V8. For Github actions, we can enforce color with env: `FORCE_COLOR: true`.
- `console-details` Show coverage details in the console. Like `text`, but for V8. For Github actions, we can enforce color with env: `FORCE_COLOR: true`.

![](./assets/console-details.png)

- `raw` only keep all original data, which can be used for other reports input with `inputDir`
- see [Merge Coverage Reports](#merge-coverage-reports)
- `markdown-summary` Save coverage summary to a markdown file (defaults to `coverage-summary.md`). For Github actions, we can show the markdown content to [a job summary](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary)
```sh
cat path-to/coverage-summary.md >> $GITHUB_STEP_SUMMARY
```
![](./assets/markdown-summary.png)

- `markdown-details` Save coverage details to a markdown file (defaults to `coverage-details.md`).

- `raw` only keep all original data, which can be used for other reports input with `inputDir`. see [Merge Coverage Reports](#merge-coverage-reports)

- Custom Reporter
```js
Expand Down
17 changes: 11 additions & 6 deletions README.zh-Hans.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,9 @@ mcr node my-app.js -r v8,console-details

> 其他内置报告 (V8和Istanbul格式数据都支持):
- `codecov`
- 专属支持[Codecov](https://docs.codecov.com/docs/codecov-custom-coverage-format)的报告, see [example](https://app.codecov.io/github/cenfun/monocart-coverage-reports)
- `codecov` 保存覆盖率数据到 [Codecov](https://docs.codecov.com/docs/codecov-custom-coverage-format) 专属的json文件 (默认是`codecov.json`), 见[例子](https://app.codecov.io/github/cenfun/monocart-coverage-reports)

- `codacy`
- 专属支持[Codacy](https://api.codacy.com/swagger#tocscoveragereport) API的报告
- `codacy` 保存覆盖率数据到 [Codacy](https://api.codacy.com/swagger#tocscoveragereport) 专属的json文件 (默认是`codacy.json`)

- `console-summary` 在控制台显示覆盖率概要

Expand All @@ -153,8 +151,15 @@ mcr node my-app.js -r v8,console-details

![](./assets/console-details.png)

- `raw` 只是保存原始覆盖率数据, 用于使用`inputDir`参数来导入多个原始数据进行合并报告
- 参见 [合并覆盖率报告](#merge-coverage-reports)
- `markdown-summary` 保存概要信息到markdown文件 (默认是`coverage-summary.md`)。 如果是Github actions, 可以把markdown的内容添加到[a job summary](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary)
```sh
cat path-to/coverage-summary.md >> $GITHUB_STEP_SUMMARY
```
![](./assets/markdown-summary.png)

- `markdown-details` 保存覆盖率详情到markdown文件 (默认是 `coverage-details.md`)

- `raw` 只是保存原始覆盖率数据, 用于使用`inputDir`参数来导入多个原始数据进行合并报告。参见 [合并覆盖率报告](#merge-coverage-reports)

- 自定义报告
```js
Expand Down
Binary file added assets/markdown-summary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d9a461d

Please sign in to comment.