Closed
Conversation
Fixes two issues that enable running tests downstream in nodejs: - Running tests using `npm run-script test` instead of the `npm test` alias will result in a failure since `test/lib/npm.js` have an assertion for "test" being the command only. This changes it so that this particular test also accepts "run-script" as the command. - Explicitly enable colors for tap output so that running the test suite in a non-tty environment will result in output that matches coloured snapshots.
darcyclarke
approved these changes
Nov 27, 2020
wraithgar
added a commit
that referenced
this pull request
Apr 6, 2022
The original PR #2225 indicated that this would prevent snapshot failures in CI with no color, but I hard set this to "0" and ran tests and they passed. This will make debugging tests in CI environments like the Node.js CITGM much easier.
wraithgar
added a commit
that referenced
this pull request
Apr 6, 2022
The original PR #2225 indicated that this would prevent snapshot failures in CI with no color, but I hard set this to "0" and ran tests and they passed. This will make debugging tests in CI environments like the Node.js CITGM much easier. The reason for the failures is because even if we hard set environment variables in tests to force color one way or another, chalk has already made up its mind so changing those in the same process won't affect anything. The fix is to hard set two values in the actual `npm test` script to make `chalk` and `supports-color` do what we need. The `sudo` test commands were also removed because we do not want to encourage running npm w/ sudo.
wraithgar
added a commit
that referenced
this pull request
May 5, 2022
The original PR #2225 indicated that this would prevent snapshot failures in CI with no color, but I hard set this to "0" and ran tests and they passed. This will make debugging tests in CI environments like the Node.js CITGM much easier. The reason for the failures is because even if we hard set environment variables in tests to force color one way or another, chalk has already made up its mind so changing those in the same process won't affect anything. The fix is to hard set two values in the actual `npm test` script to make `chalk` and `supports-color` do what we need. The `sudo` test commands were also removed because we do not want to encourage running npm w/ sudo.
wraithgar
added a commit
that referenced
this pull request
May 5, 2022
The original PR #2225 indicated that this would prevent snapshot failures in CI with no color, but I hard set this to "0" and ran tests and they passed. This will make debugging tests in CI environments like the Node.js CITGM much easier. The reason for the failures is because even if we hard set environment variables in tests to force color one way or another, chalk has already made up its mind so changing those in the same process won't affect anything. The fix is to hard set two values in the actual `npm test` script to make `chalk` and `supports-color` do what we need. The `sudo` test commands were also removed because we do not want to encourage running npm w/ sudo.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes two issues that enable running tests downstream in nodejs:
npm run-script testinstead of thenpm testalias will result in a failure sincetest/lib/npm.jshave an assertion for "test" being the command only. This changes it so that this particular test also accepts "run-script" as the command.