diff --git a/lib/cli.js b/lib/cli.js index 8a3f2cd4..75a6fe91 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -92,13 +92,19 @@ const initOptions = (cliOptions) => { const configPath = cliOptions.config; if (configPath) { if (fs.existsSync(configPath)) { - const config = require(configPath); + const config = require(path.resolve(configPath)); Object.assign(options, config); } else { EC.logRed(`Not found config: ${configPath}`); } } + // list with `,` + const reports = cliOptions.reports; + if (reports) { + cliOptions.reports = reports.split(','); + } + Object.keys(cliOptions).forEach((k) => { if (Util.hasOwn(options, k)) { options[k] = cliOptions[k]; @@ -114,6 +120,15 @@ program .argument('', 'command to execute') .option('-c, --config ') .option('-o, --outputDir ') + .option('-r, --reports ') + .option('-n, --name ') + + .option('--outputFile ') + .option('--inline') + .option('--assetsPath ') + + .option('--lcov') + .action((command, cliOptions) => { const options = initOptions(cliOptions); executeCommand(command, options); diff --git a/package.json b/package.json index 28391f49..3e09627a 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "test-node-cdp": "node --inspect=9229 ./test/test-node-cdp.js", "test-node-koa": "node ./test/test-node-koa.js", "test-browser": "node ./test/test.js", - "test-cli": "npx mcr \"node ./test/test-node-env.js\" --outputDir=docs/cli", + "test-cli": "npx mcr \"node ./test/test-node-env.js\" -o docs/cli -r v8,console-summary --lcov -c test/cli-options.js", "test": "npm run test-browser && npm run test-node && npm run test-cli && npm run build-docs", "dev": "sf d v8", "open": "node ./scripts/open.js", diff --git a/test/cli-options.js b/test/cli-options.js new file mode 100644 index 00000000..d6a72241 --- /dev/null +++ b/test/cli-options.js @@ -0,0 +1,11 @@ +module.exports = { + + entryFilter: (entry) => { + return entry.url.includes('mock/node'); + }, + + onEnd: () => { + console.log('test cli end'); + } + +};