Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --quiet-exit-code and make it default --rich-events behavior #357

Merged
merged 3 commits into from Jul 29, 2021

Conversation

andrewvc
Copy link
Contributor

Fixes #356

Accomplishes the fix by making --rich-events always exit with a code of 0, even if tests fail

Fixes elastic#356

Accomplishes the fix by making --rich-events always exit with a code of
0, even if tests fail
@andrewvc andrewvc self-assigned this Jul 28, 2021
@apmmachine
Copy link
Collaborator

apmmachine commented Jul 28, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2021-07-29T20:07:17.716+0000

  • Duration: 14 min 37 sec

  • Commit: 060ca59

Test stats 🧪

Test Results
Failed 0
Passed 123
Skipped 0
Total 123

Trends 🧪

Image of Build Times

Image of Tests

Copy link
Member

@vigneshshanmugam vigneshshanmugam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good, But I would like to propose another solution. Instead of adding a flag specific for HB, we could exit with non zero code for CI only environments?

https://www.npmjs.com/package/is-ci, we can use this. Thoughts?

@andrewvc
Copy link
Contributor Author

I'd rather avoid the dependency, and while I did say ci in the description, I think the current exit code behavior makes sense on the CLI as well, it only doesn't make sense in heartbeat.

I should mention, the flag is only there for completeness, since it's turned on by default with --rich-events heartbeat won't need to add any other flags.

@@ -41,6 +41,17 @@ describe('CLI', () => {
expect(await cli.exitCode).toBe(1);
});

describe('with --quiet-exit-code', () => {
it('runs the suites, exiting with 0', async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: would move it out of describe block to keep in same level as other test.

@@ -77,6 +88,7 @@ describe('CLI', () => {
it('mimick new heartbeat with `--rich-events` flag', async () => {
const cli = new CLIMock([
join(FIXTURES_DIR, 'fake.journey.ts'),
join(FIXTURES_DIR, 'error.journey.ts'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to increase the timeout for this specific test.

it ('asda', callback, timeout: number), Increasing with 10 secs should do it as we now test for 2 files and also screenshots which takes more than 5 seconds.

@@ -94,7 +104,7 @@ describe('CLI', () => {
});

expect(await cli.exitCode).toBe(0);
});
}, 30);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this is in milliseconds.

@andrewvc andrewvc merged commit 3f0c917 into elastic:master Jul 29, 2021
@andrewvc andrewvc deleted the quiet-exit-code branch July 29, 2021 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rich events should not exit with status > 0 when tests fail
3 participants