Skip to content

Commit

Permalink
chore: coverage支持加工
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuineng committed Jan 30, 2024
1 parent 466e334 commit 12fe640
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 12fe640

Please sign in to comment.