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: unexpected-error test expects non-colored output #4813

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

candrews
Copy link
Contributor

What does this PR do?

The assertions in unexpected-error.spec.ts expect the output being tested to not contain ANSI color codes. To ensure that is always the case, set FORCE_COLOR="0" so node doesn't output colors.

Without this change, this test will pass or fail depending upon the terminal being used to run the tests. With this change, the test runs consistently.

Where should the reviewer start?

The diff for the PR is small so I'd start with the diff.

How should this be manually tested?

Run the test with TERM unset, TERM=dumb, TERM=xterm, TERM=xterm-256color, and any other desired values. Note that with this change, the unexpected-error tests consistently pass.

Any background context you want to provide?

Relevant node documentation: https://nodejs.org/dist/latest-v18.x/docs/api/cli.html#force_color1-2-3

What are the relevant tickets?

No, but I can make one if that would be helpful - just point me to the instructions to do so :)

Screenshots

n/a

Additional questions

@candrews candrews requested review from a team as code owners August 25, 2023 14:41
candrews added a commit to candrews/snyk-cli that referenced this pull request Aug 25, 2023
apply patch for unexpected-error test expects non-colored output

See: snyk#4813
candrews added a commit to candrews/snyk-cli that referenced this pull request Aug 25, 2023
@candrews candrews force-pushed the unexpected-error-FORCE_COLOR branch from c2c701c to 32a1094 Compare August 25, 2023 14:53
The assertions in unexpected-error.spec.ts expect the output being tested to not contain ANSI color codes. To ensure that is always the case, set FORCE_COLOR="0" so node doesn't output colors.

Without this change, this test will pass or fail depending upon the terminal being used to run the tests. With this change, the test runs consistently.
@candrews candrews force-pushed the unexpected-error-FORCE_COLOR branch from 32a1094 to 558514e Compare August 25, 2023 14:57
candrews added a commit to candrews/snyk-cli that referenced this pull request Aug 25, 2023
candrews added a commit to candrews/snyk-cli that referenced this pull request Aug 25, 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
1 participant