diff --git a/README.md b/README.md index 373aa868..2612e818 100644 --- a/README.md +++ b/README.md @@ -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'` @@ -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)` diff --git a/README.zh-Hans.md b/README.zh-Hans.md index 398a89e7..827703b8 100644 --- a/README.zh-Hans.md +++ b/README.zh-Hans.md @@ -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'` @@ -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接口在程序集成