From d3a35e222a2baae9bbe6191caa6ae50587e66e85 Mon Sep 17 00:00:00 2001 From: Anudeep Date: Mon, 3 Jun 2024 17:51:55 +0530 Subject: [PATCH] fix: cli options (#194) --- package-lock.json | 4 ++-- package.json | 2 +- src/cli.js | 6 +++--- test/cli.spec.js | 9 +++++++++ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5572196..0e2bf91 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "testbeats", - "version": "2.0.3", + "version": "2.0.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "testbeats", - "version": "2.0.3", + "version": "2.0.4", "license": "ISC", "dependencies": { "async-retry": "^1.3.3", diff --git a/package.json b/package.json index 759d593..3efcf3c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "testbeats", - "version": "2.0.3", + "version": "2.0.4", "description": "Publish test results to Microsoft Teams, Google Chat, Slack and InfluxDB", "main": "src/index.js", "types": "./src/index.d.ts", diff --git a/src/cli.js b/src/cli.js index 6b1ab61..0ddae1f 100755 --- a/src/cli.js +++ b/src/cli.js @@ -8,9 +8,9 @@ const { PublishCommand } = require('./commands/publish.command'); const logger = require('./utils/logger'); prog - .version('2.0.3') - .option('--config', 'path to config file') - .option('--logLevel', 'Log Level', "INFO") + .version('2.0.4') + .option('-c, --config', 'path to config file') + .option('-l, --logLevel', 'Log Level', "INFO") .option('--slack', 'slack webhook url') .option('--teams', 'teams webhook url') .option('--chat', 'chat webhook url') diff --git a/test/cli.spec.js b/test/cli.spec.js index aead452..0135ca8 100644 --- a/test/cli.spec.js +++ b/test/cli.spec.js @@ -13,6 +13,15 @@ describe('CLI', () => { }); }); + it('publish results with alias config param', (done) => { + mock.addInteraction('post test-summary to slack'); + exec('node src/cli.js publish -c test/data/configs/slack.config.json', (error, stdout, stderr) => { + console.log(stdout); + assert.match(stdout, /✅ Results published successfully!/); + done(); + }); + }); + it('publish results with config builder', (done) => { mock.addInteraction('post test-summary to slack'); exec('node src/cli.js publish --slack http://localhost:9393/message --testng test/data/testng/single-suite.xml', (error, stdout, stderr) => {