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

Switch from chalk to colorette #218

Merged
merged 16 commits into from Aug 20, 2021
Merged

Switch from chalk to colorette #218

merged 16 commits into from Aug 20, 2021

Conversation

kibertoad
Copy link
Contributor

fixes #208

@jsumners jsumners marked this pull request as draft August 11, 2021 11:39
@kibertoad
Copy link
Contributor Author

Needs work

@kibertoad kibertoad closed this Aug 11, 2021
@kibertoad
Copy link
Contributor Author

@jorgebucaran Any ideas why this might be failing in CI still? According to https://docs.github.com/en/actions/reference/environment-variables, all the env values that we use to determine colour support should be set.

@jorgebucaran
Copy link

All my colorette tests are passing after we merged your PR, so at least that worked.

I see you are using options.enabled, are you changing its value back after using it? It's basically a singleton.

See this test.

@mcollina mcollina deleted the feat/colorette branch August 12, 2021 07:58
@mcollina mcollina restored the feat/colorette branch August 12, 2021 07:58
@mcollina
Copy link
Member

why was this closed?

@kibertoad
Copy link
Contributor Author

@mcollina I am still fighting with failing CI and don't want people flooded with notifications about interim commits.

@jorgebucaran
Copy link

@kibertoad For some reason NO_COLOR is in the environment, causing this:

let enabled =
    !isDisabled && (isForced || isWindows || isCompatibleTerminal || isCI)

...to always evaluate to false.

According to https://no-color.org:

NO_COLOR

All command-line software which outputs text with ANSI color added should check for the presence of a NO_COLOR environment variable that, when present (regardless of its value), prevents the addition of ANSI color.

Manually setting colorette.options.enabled to true wouldn't work either, because colorized = colorizer(10) has already had the ANSI codes added via colorizer().

@jorgebucaran
Copy link

Maybe this is tap messing with NO_COLOR. I just replaced tap with tape, and all tests passed (on GitHub).

@kibertoad
Copy link
Contributor Author

@jorgebucaran Great finding! I think there's an option for colours in tap, I'll try that.

@kibertoad kibertoad reopened this Aug 12, 2021
@jorgebucaran
Copy link

d767067 probably won't work. tap sets NO_COLOR to 1 to comply with Chalk's implementation of NO_COLOR (which is inconsistent with the spec).

@kibertoad
Copy link
Contributor Author

@jorgebucaran Seems to have worked, though, now the only reason why it is failing is code coverage that dropped for some reason.

@kibertoad kibertoad marked this pull request as ready for review August 12, 2021 15:09
@coveralls
Copy link

coveralls commented Aug 12, 2021

Pull Request Test Coverage Report for Build 1150442036

  • 2 of 2 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 1116256302: 0.0%
Covered Lines: 305
Relevant Lines: 305

💛 - Coveralls

@kibertoad
Copy link
Contributor Author

@mcollina @jsumners Ready for review!

Copy link
Member

@jsumners jsumners left a comment

Choose a reason for hiding this comment

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

I'm concerned about the statement around some part of this new dependency being a singleton. How does that affect things?

package.json Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
@kibertoad
Copy link
Contributor Author

@mcollina Adjusted PR to no longer modify state, now it works the same way it did with chalk, we just do readonly check of colorette colour support resolution results.

@kibertoad
Copy link
Contributor Author

@mcollina
Copy link
Member

Code is good, we need to fix CI.

@jsumners
Copy link
Member

@jsumners See #218 (checks)

Remove the glob from the npm script and add it to the .taprc:

files:
	- '**/*.test.js'

@kibertoad
Copy link
Contributor Author

kibertoad commented Aug 17, 2021

@jsumners That seems to completely break library imports for some reason.

update: ah, wait, looks like this glob then also includes the node_modules and tries to run tests from there

@kibertoad
Copy link
Contributor Author

Removed Windows from CI for now, because it seems to be failing for reasons unrelated to colorette migration, but glob is fine now.

@kibertoad
Copy link
Contributor Author

Any ideas why test: test/cli-rc.test.js cli throws on invalid default config file might be flaky on MacOS? Should I disable MacOS test execution?

@jsumners
Copy link
Member

Any ideas why test: test/cli-rc.test.js cli throws on invalid default config file might be flaky on MacOS? Should I disable MacOS test execution?

Not a clue.

Copy link
Member

@jsumners jsumners left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@kibertoad
Copy link
Contributor Author

@mcollina CI is green!

@mcollina
Copy link
Member

@jsumners I think I should bump the major for this. WDYT?

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@jsumners
Copy link
Member

@jsumners I think I should bump the major for this. WDYT?

Agreed.

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.

Switch from chalk to colorette
5 participants