From fb83855b64456ea6d43e3406d935dd9e4f708f0a Mon Sep 17 00:00:00 2001 From: cenfun Date: Mon, 18 Nov 2024 23:07:45 +0800 Subject: [PATCH] fixed cli to support `merge` command --- CHANGELOG.md | 3 +++ lib/cli.js | 11 +++++++++++ package.json | 9 +++++---- test/package.json | 4 ++-- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b368737..6a0f5e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## Changelog +- 2.11.3 + - fixed cli to support `merge` command + - 2.11.2 - fixed log style diff --git a/lib/cli.js b/lib/cli.js index fdc73b6..ef32514 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -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); diff --git a/package.json b/package.json index 5c0d5ae..7945039 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", @@ -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" } } diff --git a/test/package.json b/test/package.json index baa083b..55665f0 100644 --- a/test/package.json +++ b/test/package.json @@ -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",