Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
format: fix issues with colors support (#2026)
* install supports-color * add test * use supports-color, override if needed * simplify wording * look for FORCE_COLOR, refactor * check for FORCE_COLOR precedence * docs * tweak feature wording * update docs a bit * ditch the sniffFlags option * add comment * add changelog entry * Update docs/formatters.md Co-authored-by: Aurélien Reeves <aurelien.reeves@smartbear.com> Co-authored-by: Aurélien Reeves <aurelien.reeves@smartbear.com>
- Loading branch information
1 parent
5c8409c
commit d00a670
Showing
15 changed files
with
294 additions
and
56 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
@spawn | ||
Feature: Colors | ||
|
||
As a developer | ||
I want to control when/whether the output includes colors | ||
|
||
Background: | ||
Given a file named "features/a.feature" with: | ||
""" | ||
Feature: | ||
Scenario: | ||
Given a step | ||
""" | ||
And a file named "features/step_definitions/steps.js" with: | ||
""" | ||
const {Given} = require('@cucumber/cucumber') | ||
Given('a step', function() {}) | ||
""" | ||
And a file named "cucumber.json" with: | ||
""" | ||
{ "default": { "format": ["summary:summary.out"] } } | ||
""" | ||
|
||
Scenario: no colored output by default for a file stream | ||
When I run cucumber-js | ||
Then the file "summary.out" doesn't contain colors | ||
|
||
Scenario: colored output can be activated with the format option | ||
When I run cucumber-js with `--format-options '{"colorsEnabled":true}'` | ||
Then the file "summary.out" contains colors | ||
|
||
Scenario: colored output can be activated with FORCE_COLOR | ||
When I run cucumber-js with env `FORCE_COLOR=1` | ||
Then the file "summary.out" contains colors | ||
|
||
Scenario: FORCE_COLOR takes precedence over the format option | ||
When I run cucumber-js with arguments `--format-options '{"colorsEnabled":false}'` and env `FORCE_COLOR=1` | ||
Then the file "summary.out" contains colors |
This file contains 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
Oops, something went wrong.