Skip to content

Commit

Permalink
chore: coverage支持加工 (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuineng authored Jan 30, 2024
1 parent 466e334 commit 565ad3f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/helper/coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module.exports = wd => {
let {
coverageIgnore = program.coverageIgnore,
keys = [],
coverageHandler,
} = opts;
const tempDir = path.join(cwd, 'coverage', '.temp');
_.mkdir(tempDir);
Expand Down Expand Up @@ -57,7 +58,11 @@ module.exports = wd => {
const coverage = await this.execute(`return window.__coverage__['${keys[i]}']`);
if (coverage) {
const coverageJSON = JSON.stringify(coverage);
writer.write(`"${keys[i]}":${coverageJSON}`);
let covChunk;
if (coverageHandler) {
covChunk = await coverageHandler(keys[i], coverageJSON);
}
writer.write(covChunk || `"${keys[i]}":${coverageJSON}`);
if (i < keys.length - 1) {
writer.write(',');
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "macaca-wd",
"version": "4.3.5",
"version": "4.3.6",
"description": "Macaca webdirver API for Node.js",
"keywords": [
"macaca",
Expand Down

0 comments on commit 565ad3f

Please sign in to comment.