-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Update color
flag behaviour
#1653
Conversation
test/unit/cli.test.js
Outdated
done(); | ||
}); | ||
}); | ||
it('should have color enabled with `--color on`', function (done) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline between successive it
blocks.
test/cli/color-tty.test.js
Outdated
@@ -5,7 +5,7 @@ describe('CLI output', function () { | |||
|
|||
describe('TTY', function () { | |||
// @todo: Change to assert colored output after https://github.com/shelljs/shelljs/pull/524 is released | |||
it('should produce colored output without any options', function (done) { | |||
it.skip('should produce colored output without any options', function (done) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to get this figured out.
lib/reporters/cli/cli-utils.js
Outdated
* @returns {Boolean} - A boolean value depicting the result of the noTTY check. | ||
*/ | ||
noTTY: function (color) { | ||
return !color && (Boolean(process.env.CI) || !process.stdout.isTTY); // eslint-disable-line no-process-env | ||
return (color === 'off') || !(color === 'on') && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
color !== 'on'
@codenirvana Changelog, migration guide and readme need updates as well |
CHANGELOG.yaml
Outdated
@@ -7,6 +7,7 @@ unreleased: | |||
- '#1605 Dropped support for Node < v6' | |||
- '#1610 Dropped support for v2 CLI options' | |||
- '#1616 Moved inbuilt HTML reporter to a standalone reporter: https://github.com/postmanlabs/newman-reporter-html' | |||
- '#1653 Updated `color` option behaviour' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also append: dropped support for --no-color
MIGRATION.md
Outdated
@@ -34,6 +34,85 @@ Newman v4 requires Node.js >= v6. [Install Node.js via package manager](https:// | |||
Newman v4 drops support for all the deprecated v2 CLI options, check [V2 to V3 Migration Guide](#v2-to-v3-migration-guide).<br/> | |||
For the complete list of supported options, see the [README](README.md) | |||
|
|||
#### --no-color | |||
This option is dropped in favor of changes made in `color` option. A detailed guide on color option is available below. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the changes made to the --color
option. See the section below for more details.
MIGRATION.md
Outdated
|
||
**Note:** | ||
The default color value is set to `auto` so, Newman attempts to automatically turn color on or off based on the colors support in the terminal. | ||
This behaviour can be modified by using the `on` or `off` value accordingly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by setting the color
option to on
or off
respectively.
MIGRATION.md
Outdated
``` | ||
|
||
**Note:** | ||
The default color value is set to `auto` so, Newman attempts to automatically turn color on or off based on the colors support in the terminal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default behaviour is to detect color support for the terminal and act accordingly.
README.md
Outdated
that output to console. | ||
- `--color <value>`<br /> | ||
Enable or Disable colored CLI output. The color value can be any of the three: `on`, `off` or `auto`*(default)*.<br/> | ||
With `auto`, Newman attempts to automatically turn color on or off based on the colors support in the terminal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
color support
MIGRATION.md
Outdated
This option is dropped in favor of changes made in `color` option. A detailed guide on color option is available below. | ||
|
||
### Using `color` option | ||
The behaviour of this option is changed in both CLI and Library. Unlike previously, this option alone can be used to enable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previously -> Newman v3.x
MIGRATION.md
Outdated
The behaviour of this option is changed in both CLI and Library. Unlike previously, this option alone can be used to enable | ||
or disable colored CLI output. | ||
|
||
#### Migrations in CLI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CLI
MIGRATION.md
Outdated
$ newman run collection.json --color off | ||
``` | ||
|
||
#### Migrations in Library |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Library
--no-color
CLI flag. Equivalent:--color off
noColor
Library options. Equivalent:color: 'off'
--color
argument &color
library option supports following value:process.env.CI
orprocess.stdout.isTTY
auto
.Todo:
Reference: #1644
Fixes #1636