Skip to content

Commit

Permalink
fixed cli to support merge command
Browse files Browse the repository at this point in the history
  • Loading branch information
cenfun committed Nov 18, 2024
1 parent ce6b601 commit fb83855
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Changelog

- 2.11.3
- fixed cli to support `merge` command

- 2.11.2
- fixed log style

Expand Down
11 changes: 11 additions & 0 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,21 @@ const initNodeV8CoverageDir = (coverageOptions) => {
return nodeV8CoverageDir;
};

const mergeCoverage = async (cliOptions) => {
const coverageReport = MCR(cliOptions);
await coverageReport.loadConfig(cliOptions.config);
coverageReport.cleanCache();
await coverageReport.generate();
};

const executeCommand = async (command, cliOptions) => {

Util.logInfo(`Execute: ${EC.cyan(command)}`);

if (command === 'merge') {
return mergeCoverage(cliOptions);
}

// before load config
await initNodeOptions(cliOptions);

Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"test-merge": "node ./test/test-merge.js",
"test-merge-istanbul": "node ./test/test-merge-istanbul.js",
"test-merge-v8": "node ./test/test-merge-v8.js",
"test-merge-cli": "npx mcr merge -r console-details,v8 --inputDir .temp/code-coverage/raw --outputDir .temp/merge-cli",
"test-client": "node ./test/test-client.js",
"test-all": "node ./test/test.js",
"test-pr": "node --inspect=9230 ./test/test-pr.js",
Expand Down Expand Up @@ -95,16 +96,16 @@
"convert-source-map": "^2.0.0",
"diff-sequences": "^29.6.3",
"esbuild": "^0.24.0",
"eslint": "~9.14.0",
"eslint": "~9.15.0",
"eslint-config-plus": "^2.0.2",
"eslint-plugin-html": "^8.1.2",
"eslint-plugin-vue": "^9.30.0",
"eslint-plugin-vue": "^9.31.0",
"find-up": "^7.0.0",
"minimatch": "^9.0.5",
"monocart-code-viewer": "^1.1.4",
"monocart-formatter": "^3.0.0",
"node-stream-zip": "^1.15.0",
"postcss": "^8.4.47",
"postcss": "^8.4.49",
"starfall-cli": "^2.0.20",
"stylelint": "^16.10.0",
"stylelint-config-plus": "^1.1.3",
Expand All @@ -113,6 +114,6 @@
"turbogrid": "^3.2.0",
"vine-ui": "^3.1.16",
"ws": "^8.18.0",
"yazl": "^3.2.1"
"yazl": "^3.3.0"
}
}
4 changes: 2 additions & 2 deletions test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"mocha": "^10.8.2",
"open": "^10.1.0",
"playwright": "^1.48.2",
"puppeteer": "^23.7.0",
"rollup": "^4.24.4",
"puppeteer": "^23.8.0",
"rollup": "^4.27.2",
"swc-loader": "^0.2.6",
"ts-loader": "^9.5.1",
"typescript": "^5.6.3",
Expand Down

0 comments on commit fb83855

Please sign in to comment.