Skip to content

Commit

Permalink
chore: print generated json
Browse files Browse the repository at this point in the history
  • Loading branch information
ASaiAnudeep committed Jun 3, 2024
1 parent 3a7aefd commit 6549a9d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- run: node src/cli.js publish --slack {SLACK_MVP_URL} --title 'Unit Tests' --ci-info --chart-test-summary --junit 'results/junit.xml'
if: always()
env:
TEST_BEATS_API_KEY: ${{ secrets.TEST_BEATS_API_KEY }}
# TEST_BEATS_API_KEY: ${{ secrets.TEST_BEATS_API_KEY }}
SLACK_MVP_URL: ${{ secrets.SLACK_MVP_URL }}
- uses: actions/upload-artifact@v4
if: always()
Expand Down
7 changes: 6 additions & 1 deletion src/utils/config.builder.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
const path = require('path');
const logger = require('./logger');

class ConfigBuilder {

/**
Expand All @@ -21,6 +24,8 @@ class ConfigBuilder {
this.#buildTargets();
this.#buildExtensions();

logger.info(`🛠️ Generated Config: ${JSON.stringify(this.config, null, 2)}`);

this.opts.config = this.config;
}

Expand Down Expand Up @@ -67,7 +72,7 @@ class ConfigBuilder {
this.config.results = [
{
type,
files: [file]
files: [path.join(file)]
}
]
}
Expand Down
4 changes: 4 additions & 0 deletions test/cli.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ describe('CLI', () => {
it('publish results with config file', (done) => {
mock.addInteraction('post test-summary to slack');
exec('node src/cli.js publish --config test/data/configs/slack.config.json', (error, stdout, stderr) => {
console.log(stdout);
assert.match(stdout, /✅ Results published successfully!/);
done();
});
Expand All @@ -15,6 +16,7 @@ describe('CLI', () => {
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) => {
console.log(stdout);
assert.match(stdout, /✅ Results published successfully!/);
done();
});
Expand All @@ -23,6 +25,7 @@ describe('CLI', () => {
it('publish results with config builder and extension', (done) => {
mock.addInteraction('post test-summary to teams with qc-test-summary', { quickChartUrl: "https://quickchart.io" });
exec('node src/cli.js publish --teams http://localhost:9393/message --testng test/data/testng/single-suite-failures.xml --chart-test-summary', (error, stdout, stderr) => {
console.log(stdout);
assert.match(stdout, /✅ Results published successfully!/);
done();
});
Expand All @@ -32,6 +35,7 @@ describe('CLI', () => {
mock.addInteraction('post test results to beats');
mock.addInteraction('post test-summary with beats to teams');
exec('node src/cli.js publish --api-key api-key --project project-name --run build-name --teams http://localhost:9393/message --testng test/data/testng/single-suite.xml', (error, stdout, stderr) => {
console.log(stdout);
assert.match(stdout, /🚀 Publishing results to TestBeats Portal/);
assert.match(stdout, /✅ Results published successfully!/);
done();
Expand Down

0 comments on commit 6549a9d

Please sign in to comment.