Skip to content

Commit

Permalink
doc OOM, log time
Browse files Browse the repository at this point in the history
  • Loading branch information
cenfun committed Jun 30, 2024
1 parent f86ad5e commit e97a675
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,15 @@ const coverageOptions = {
}
```

### JavaScript heap out of memory
When there are a lot of raw v8 coverage files to process, it may cause OOM. We can try the following Node.js options:
```sh
- run: npm run test:coverage
env:
NODE_OPTIONS: --max-old-space-size=8192
```


## Debug for Coverage and Sourcemap
> Sometimes, the coverage is not what we expect. The next step is to figure out why, and we can easily find out the answer step by step through debugging.
- Start debugging for v8 report with option `logging: 'debug'`
Expand All @@ -900,6 +909,11 @@ When `logging` is `debug`, the raw report data will be preserved in `[outputDir]
![](./assets/debug-sourcemap.png)
- Show time logs with env `MCR_LOG_TIME`
```js
process.env.MCR_LOG_TIME = true
```
## Integration with Any Testing Framework
- API
- Collecting coverage data when any stage of the test is completed, and adding the coverage data to the coverage reporter. `await mcr.add(coverageData)`
Expand Down
14 changes: 14 additions & 0 deletions README.zh-Hans.md
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,15 @@ const coverageOptions = {
}
```
### JavaScript heap out of memory
内存溢出问题可能出现在有太多的原生V8覆盖率文件要处理. 我们可以使用Node.js的一个选项来增加内存使用:
```sh
- run: npm run test:coverage
env:
NODE_OPTIONS: --max-old-space-size=8192
```
## Debug for Coverage and Sourcemap
> 当你觉得覆盖率存在问题的时候,`MCR`支持自行调试来核验覆盖率的准确性
- 首先打开调试设置`logging: 'debug'`
Expand All @@ -903,6 +912,11 @@ const coverageOptions = {
![](./assets/debug-sourcemap.png)
- 使用环境变量`MCR_LOG_TIME`显示时间日志
```js
process.env.MCR_LOG_TIME = true
```
## Integration with Any Testing Framework
通用集成方案
- 通过API接口在程序集成
Expand Down

0 comments on commit e97a675

Please sign in to comment.