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

Update color flag behaviour #1653

Merged
merged 9 commits into from
Aug 3, 2018
Merged

Update color flag behaviour #1653

merged 9 commits into from
Aug 3, 2018

Conversation

codenirvana
Copy link
Member

@codenirvana codenirvana commented Aug 1, 2018

  1. Drops support for --no-color CLI flag. Equivalent: --color off
  2. Drops support for noColor Library options. Equivalent: color: 'off'
  3. --color argument & color library option supports following value:
    • auto (default) - chooses based on process.env.CI or process.stdout.isTTY
    • on
    • off
      • anything other than these three falls back to auto.

Todo:

  • Update README
  • Update CHANGELOG
  • Update MIGRATION

Reference: #1644
Fixes #1636

@codenirvana codenirvana added the v4 label Aug 1, 2018
@codenirvana codenirvana self-assigned this Aug 1, 2018
done();
});
});
it('should have color enabled with `--color on`', function (done) {
Copy link
Contributor

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.

@@ -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) {
Copy link
Contributor

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.

* @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') &&
Copy link
Contributor

Choose a reason for hiding this comment

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

color !== 'on'

@kunagpal
Copy link
Contributor

kunagpal commented Aug 1, 2018

@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'
Copy link
Contributor

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.
Copy link
Contributor

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.
Copy link
Contributor

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.
Copy link
Contributor

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.
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

Library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants