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

test(shell): ensure that fields that aren't checked are empty #4900

Merged
merged 2 commits into from
Oct 14, 2022

Conversation

paul-soporan
Copy link
Member

Important: The tests are supposed to fail.

They are supposed to fail on master too, and this PR only surfaces the issue. I'll probably open a PR in the future fixing the issue too, but first, this one should be merged.


What's the problem this PR addresses?

Most shell tests only check some of the result fields (exitCode, stdout, and stderr).
Because of this, some bugs can slip through, such as #4892 (where the test passes because the error is a recoverable shell error, so the shell writes it to stderr and exits with exit code 1, but we don't check for the exit code).

How did you fix it?

I made all tests use expectResult, which ensures that fields that aren't specified are empty (0 or empty string).

Checklist

  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@arcanis
Copy link
Member

arcanis commented Sep 28, 2022

Since there's a single test that's failing, could it be fixed in the same PR?

`echo "\${FOOBAR:+hello world}"`,
)).resolves.toMatchObject({
), {
stdout: ``,

This comment was marked as outdated.

Copy link
Contributor

Choose a reason for hiding this comment

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

I modified this test in another PR: ca63766

make the #4959 test pass🥺

`echo "\${1:+hello world}"`,
)).resolves.toMatchObject({
), {
stdout: `hello world\n`,

This comment was marked as outdated.

@arcanis arcanis merged commit ab173a9 into master Oct 14, 2022
@arcanis arcanis deleted the paul/test/shell/check-all-fields branch October 14, 2022 09:39
merceyz pushed a commit that referenced this pull request Oct 22, 2023
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.

3 participants