Cucumber / Cucumber Js / Docs
Colors
As a developer I want to control when/whether the output includes colors
Background:
- Given a file named "
features/a.feature" with:gherkinFeature: Scenario: Given a step - And a file named "
features/step_definitions/steps.js" with:rubyconst {Given} = require('@cucumber/cucumber') Given('a step', function() {}) - And a file named "
cucumber.json" with:json{ "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 - And the error output contains the text:
text
The 'colorsEnabled' format option is deprecated and will be removed in a future major version. Setting FORCE_COLOR=1 based on the provided value.
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
Source: features/colors.feature at commit 3ac6ecda, Cucumber Js (MIT license).