testing-library / dom-testing-library

🐙 Simple and complete DOM testing utilities that encourage good testing practices.
https://testing-library.com/dom
MIT License
3.26k stars 467 forks source link

feat: Allow disabling colorized debug output #1166

Closed MynockSpit closed 1 year ago

MynockSpit commented 2 years ago

What:

Add an environment flag that allows turning off of colors from the command line.

Why:

Some environments current flag as "node", but print logs in formats that don't handle colorization which makes reading the logs hard to read.

More details here: https://github.com/testing-library/dom-testing-library/issues/1153

How:

Changed the isNode function to shouldHighlight, and check for the environment variable before checking for the

Checklist:

codesandbox-ci[bot] commented 2 years ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit d79febc4ad3e14fd68acf9709c1d227a9b41c2b1:

Sandbox Source
react-testing-library-examples Configuration
codecov[bot] commented 2 years ago

Codecov Report

Merging #1166 (d79febc) into main (2a9ee25) will not change coverage. The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main     #1166   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           24        24           
  Lines          990       996    +6     
  Branches       325       327    +2     
=========================================
+ Hits           990       996    +6     
Flag Coverage Δ
node-12 100.00% <100.00%> (ø)
node-14 100.00% <100.00%> (ø)
node-16 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/pretty-dom.js 100.00% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

eps1lon commented 2 years ago

Thanks. This needs documentation to acompany it.

MynockSpit commented 2 years ago

I took a stab at updating the docs. Let me know what you think!

https://github.com/testing-library/testing-library-docs/pull/1148

eps1lon commented 1 year ago

@all-contributors add @MynockSpit for code

allcontributors[bot] commented 1 year ago

@eps1lon

I've put up a pull request to add @MynockSpit! :tada:

github-actions[bot] commented 1 year ago

:tada: This PR is included in version 8.18.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: