From c6ff308fa8d81810b9b62efec1c58121aa6d7ddc Mon Sep 17 00:00:00 2001
From: David Goss <dvdgoss@gmail.com>
Date: Thu, 20 Feb 2020 22:19:37 +0000
Subject: [PATCH 01/12] update error message

---
 src/cli/argv_parser.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cli/argv_parser.ts b/src/cli/argv_parser.ts
index 14c010f70..6911fae25 100644
--- a/src/cli/argv_parser.ts
+++ b/src/cli/argv_parser.ts
@@ -93,7 +93,7 @@ const ArgvParser = {
   validateRetryOptions(options: IParsedArgvOptions): void {
     if (options.retryTagFilter !== '' && options.retry === 0) {
       throw new Error(
-        'a positive --retry count must be specified when setting --retryTagFilter'
+        'a positive --retry count must be specified when setting --retry-tag-filter'
       )
     }
   },

From 0dfedecd725fd372a4f580b41f5703a3e2b11c6a Mon Sep 17 00:00:00 2001
From: David Goss <dvdgoss@gmail.com>
Date: Thu, 20 Feb 2020 22:38:53 +0000
Subject: [PATCH 02/12] switch to kebab-case

---
 dist/cucumber.js       |  2 +-
 features/retry.feature | 24 ++++++++++++------------
 src/cli/argv_parser.ts |  6 +++---
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/dist/cucumber.js b/dist/cucumber.js
index 5eeaa5d7f..c22addacb 100644
--- a/dist/cucumber.js
+++ b/dist/cucumber.js
@@ -73240,7 +73240,7 @@ function () {
       });
       program.parse(argv);
       var options = program.opts();
-      ArgvParser.validateRetryOptions(options);
+      ArgvParser.validateRetryOptions(argv, options);
       return {
         options: options,
         args: program.args
diff --git a/features/retry.feature b/features/retry.feature
index 44100f783..9ce9bc3ce 100644
--- a/features/retry.feature
+++ b/features/retry.feature
@@ -1,14 +1,14 @@
 Feature: Retry flaky tests
 
   Using the `--retry` flag will retry failing tests for the specified number of times
-  Additionally using the `--retryTagFilter` flag will re-run only tests matching the tag expression
+  Additionally using the `--retry-tag-filter` flag will re-run only tests matching the tag expression
 
   @spawn
-  Scenario: running Cucumber JS with --retryTagFilter but no positive --retry will fail
-    When I run cucumber-js with `--retryTagFilter @flaky`
+  Scenario: running Cucumber JS with --retry-tag-filter but no positive --retry will fail
+    When I run cucumber-js with `--retry-tag-filter @flaky`
     Then the error output contains the text:
       """
-      Error: a positive --retry count must be specified when setting --retryTagFilter
+      Error: a positive --retry count must be specified when setting --retry-tag-filter
       """
     And it fails
 
@@ -322,7 +322,7 @@ Feature: Retry flaky tests
       """
     And it fails
 
-  Scenario: retrying a flaky test matching --retryTagFilter will eventually make it pass
+  Scenario: retrying a flaky test matching --retry-tag-filter will eventually make it pass
     Given a file named "features/a.feature" with:
       """
       Feature:
@@ -344,12 +344,12 @@ Feature: Retry flaky tests
         throw 'fail'
       })
       """
-    When I run cucumber-js with `--retry 1 --retryTagFilter '@flaky'`
+    When I run cucumber-js with `--retry 1 --retry-tag-filter '@flaky'`
     Then scenario "Flaky" attempt 0 step "Given a flaky step" has status "failed"
     Then scenario "Flaky" attempt 1 step "Given a flaky step" has status "passed"
     And it passes
 
-  Scenario: a flaky test not matching --retryTagFilter won't re-run and just fail
+  Scenario: a flaky test not matching --retry-tag-filter won't re-run and just fail
     Given a file named "features/a.feature" with:
       """
       Feature:
@@ -371,11 +371,11 @@ Feature: Retry flaky tests
         throw 'fail'
       })
       """
-    When I run cucumber-js with `--retry 1 --retryTagFilter '@not_flaky'`
+    When I run cucumber-js with `--retry 1 --retry-tag-filter '@not_flaky'`
     Then scenario "Flaky" step "Given a flaky step" has status "failed"
     And it fails
 
-  Scenario: retrying a flaky test matching --retryTagFilter will eventually make it pass but not-matching will not be retried (AND operator between tags)
+  Scenario: retrying a flaky test matching --retry-tag-filter will eventually make it pass but not-matching will not be retried (AND operator between tags)
     Given a file named "features/a.feature" with:
       """
       Feature:
@@ -410,13 +410,13 @@ Feature: Retry flaky tests
         throw 'fail'
       })
       """
-    When I run cucumber-js with `--retry 1 --retryTagFilter '@flaky and @anOtherTag'`
+    When I run cucumber-js with `--retry 1 --retry-tag-filter '@flaky and @anOtherTag'`
     Then scenario "Flaky" attempt 0 step "Given a flaky step" has status "failed"
     Then scenario "Flaky" attempt 1 step "Given a flaky step" has status "passed"
     And scenario "Also Flaky" step "Given an other flaky step" has status "failed"
     And it fails
 
-  Scenario: retrying a flaky test matching --retryTagFilter will eventually make it pass but not-matching will not be retried (OR operator between tags)
+  Scenario: retrying a flaky test matching --retry-tag-filter will eventually make it pass but not-matching will not be retried (OR operator between tags)
     Given a file named "features/a.feature" with:
       """
       Feature:
@@ -464,7 +464,7 @@ Feature: Retry flaky tests
         throw 'fail'
       })
       """
-    When I run cucumber-js with `--retry 1 --retryTagFilter '@anOtherTag or @oneMoreTag'`
+    When I run cucumber-js with `--retry 1 --retry-tag-filter '@anOtherTag or @oneMoreTag'`
     Then scenario "Flaky" attempt 0 step "Given a flaky step" has status "failed"
     And scenario "Flaky" attempt 1 step "Given a flaky step" has status "passed"
     And scenario "Also Flaky" attempt 0 step "Given an other flaky step" has status "failed"
diff --git a/src/cli/argv_parser.ts b/src/cli/argv_parser.ts
index 6911fae25..b63f72f2e 100644
--- a/src/cli/argv_parser.ts
+++ b/src/cli/argv_parser.ts
@@ -90,7 +90,7 @@ const ArgvParser = {
     return value
   },
 
-  validateRetryOptions(options: IParsedArgvOptions): void {
+  validateRetryOptions(argv: string[], options: IParsedArgvOptions): void {
     if (options.retryTagFilter !== '' && options.retry === 0) {
       throw new Error(
         'a positive --retry count must be specified when setting --retry-tag-filter'
@@ -188,7 +188,7 @@ const ArgvParser = {
         0
       )
       .option(
-        '--retryTagFilter <EXPRESSION>',
+        '--retry-tag-filter <EXPRESSION>',
         `only retries the features or scenarios with tags matching the expression (repeatable).
         This option requires '--retry' to be specified.`,
         ArgvParser.mergeTags,
@@ -217,7 +217,7 @@ const ArgvParser = {
 
     program.parse(argv)
     const options = program.opts() as IParsedArgvOptions
-    ArgvParser.validateRetryOptions(options)
+    ArgvParser.validateRetryOptions(argv, options)
 
     return {
       options,

From 4ab6d6f591c46c8725e966c69abb3b7f109b59d5 Mon Sep 17 00:00:00 2001
From: David Goss <dvdgoss@gmail.com>
Date: Sat, 22 Feb 2020 18:22:32 +0000
Subject: [PATCH 03/12] issue warning when using camel case for
 --retry-tag-filter; make warnings testable

---
 features/retry.feature                 | 20 ++++++++++++++++++++
 features/step_definitions/cli_steps.ts |  5 +++++
 features/support/world.ts              |  7 +++++++
 src/cli/argv_parser.ts                 |  2 +-
 src/cli/index.ts                       | 25 +++++++++++++++++++++----
 5 files changed, 54 insertions(+), 5 deletions(-)

diff --git a/features/retry.feature b/features/retry.feature
index 9ce9bc3ce..e3ade658a 100644
--- a/features/retry.feature
+++ b/features/retry.feature
@@ -12,6 +12,26 @@ Feature: Retry flaky tests
       """
     And it fails
 
+  Scenario: running Cucumber JS with --retryTagFilter in camel case will result in a warning
+    Given a file named "features/a.feature" with:
+      """
+      Feature:
+        Scenario:
+          Given a step
+      """
+    Given a file named "features/step_definitions/cucumber_steps.js" with:
+      """
+      const {Given} = require('cucumber')
+
+      Given(/^a step$/, function() {})
+      """
+    When I run cucumber-js with `--retry 1 --retryTagFilter @flaky`
+    Then it issues the warning:
+      """
+      the argument --retryTagFilter is deprecated and will be removed in a future release; please use --retry-tag-filter
+      """
+    But it passes
+
   Scenario: running Cucumber JS with negative --retry will fail
     When I run cucumber-js with `--retry -1`
     Then the error output contains the text:
diff --git a/features/step_definitions/cli_steps.ts b/features/step_definitions/cli_steps.ts
index 02843d5ab..c56600244 100644
--- a/features/step_definitions/cli_steps.ts
+++ b/features/step_definitions/cli_steps.ts
@@ -57,6 +57,11 @@ Then(/^it fails$/, function(this: World) {
   this.verifiedLastRunError = true
 })
 
+Then(/^it issues the warning:$/, function(this: World, text: string) {
+  const warnings: string[] = this.lastRun.warnings
+  expect(warnings).to.include(text)
+})
+
 Then(/^it outputs the text:$/, function(this: World, text) {
   const actualOutput = normalizeText(this.lastRun.output)
   const expectedOutput = normalizeText(text)
diff --git a/features/support/world.ts b/features/support/world.ts
index b5a416916..06134dfda 100644
--- a/features/support/world.ts
+++ b/features/support/world.ts
@@ -16,6 +16,7 @@ interface ILastRun {
   errorOutput: string
   envelopes: messages.IEnvelope[]
   output: string
+  warnings: string[]
 }
 
 interface IRunResult {
@@ -49,6 +50,10 @@ export class World {
         return arg
       })
     const cwd = this.tmpDir
+    const warnings: string[] = []
+    const warn = (message: string): void => {
+      warnings.push(message)
+    }
 
     let result: IRunResult
 
@@ -64,6 +69,7 @@ export class World {
         argv: args,
         cwd,
         stdout,
+        warn,
       })
       let error: any, stderr: string
       try {
@@ -105,6 +111,7 @@ export class World {
       errorOutput: result.stderr,
       envelopes,
       output: colors.strip(result.stdout),
+      warnings,
     }
     this.verifiedLastRunError = false
     expect(this.lastRun.output).to.not.include('Unhandled rejection')
diff --git a/src/cli/argv_parser.ts b/src/cli/argv_parser.ts
index b63f72f2e..9f2fcf470 100644
--- a/src/cli/argv_parser.ts
+++ b/src/cli/argv_parser.ts
@@ -188,7 +188,7 @@ const ArgvParser = {
         0
       )
       .option(
-        '--retry-tag-filter <EXPRESSION>',
+        '--retryTagFilter, --retry-tag-filter <EXPRESSION>',
         `only retries the features or scenarios with tags matching the expression (repeatable).
         This option requires '--retry' to be specified.`,
         ArgvParser.mergeTags,
diff --git a/src/cli/index.ts b/src/cli/index.ts
index ab1d4a2aa..16ffe15a4 100644
--- a/src/cli/index.ts
+++ b/src/cli/index.ts
@@ -42,16 +42,33 @@ export default class Cli {
   private readonly argv: string[]
   private readonly cwd: string
   private readonly stdout: IFormatterStream
+  private readonly warn: (message: string) => void
 
-  constructor({ argv, cwd, stdout }) {
+  constructor({ argv, cwd, stdout, warn = console.warn }) {
     this.argv = argv
     this.cwd = cwd
     this.stdout = stdout
+    this.warn = warn
   }
 
   async getConfiguration(): Promise<IConfiguration> {
-    const fullArgv = await getExpandedArgv({ argv: this.argv, cwd: this.cwd })
-    return ConfigurationBuilder.build({ argv: fullArgv, cwd: this.cwd })
+    const fullArgv = await getExpandedArgv({
+      argv: this.argv,
+      cwd: this.cwd,
+    })
+    this.lintArgv(fullArgv)
+    return ConfigurationBuilder.build({
+      argv: fullArgv,
+      cwd: this.cwd,
+    })
+  }
+
+  private lintArgv(fullArgv: string[]): void {
+    if (fullArgv.includes('--retryTagFilter')) {
+      this.warn(
+        'the argument --retryTagFilter is deprecated and will be removed in a future release; please use --retry-tag-filter'
+      )
+    }
   }
 
   async initializeFormatters({
@@ -83,7 +100,7 @@ export default class Cli {
       }
       if (type === 'progress-bar' && !(stream as TtyWriteStream).isTTY) {
         const outputToName = outputTo === '' ? 'stdout' : outputTo
-        console.warn(
+        this.warn(
           `Cannot use 'progress-bar' formatter for output to '${outputToName}' as not a TTY. Switching to 'progress' formatter.`
         )
         type = 'progress'

From 70ee17597f029f3e20a95004a6159a380736af95 Mon Sep 17 00:00:00 2001
From: David Goss <dvdgoss@gmail.com>
Date: Sat, 22 Feb 2020 19:01:14 +0000
Subject: [PATCH 04/12] update docs to reference correct case

---
 docs/cli.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/cli.md b/docs/cli.md
index 7c58fd06c..dd8df886d 100644
--- a/docs/cli.md
+++ b/docs/cli.md
@@ -131,7 +131,7 @@ By default, cucumber-js runs the entire suite and reports all the failures. This
 ## Retry failing tests
 
 Use `--retry <int>` to rerun tests that have been failing. This can be very helpful for flaky tests.
-To only retry failing tests in a subset of test use `--retryTagFilter <EXPRESSION>` (use the same as in Use [Tags](#tags))
+To only retry failing tests in a subset of test use `--retry-tag-filter <EXPRESSION>` (use the same as in Use [Tags](#tags))
 
 ## Transpilation
 

From 04db71c301a8e04dfb257b41a1e1940c85eae54a Mon Sep 17 00:00:00 2001
From: David Goss <dvdgoss@gmail.com>
Date: Sat, 22 Feb 2020 19:20:14 +0000
Subject: [PATCH 05/12] whoops remove arg we dont need

---
 src/cli/argv_parser.ts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/cli/argv_parser.ts b/src/cli/argv_parser.ts
index 9f2fcf470..3d394c6b9 100644
--- a/src/cli/argv_parser.ts
+++ b/src/cli/argv_parser.ts
@@ -90,7 +90,7 @@ const ArgvParser = {
     return value
   },
 
-  validateRetryOptions(argv: string[], options: IParsedArgvOptions): void {
+  validateRetryOptions(options: IParsedArgvOptions): void {
     if (options.retryTagFilter !== '' && options.retry === 0) {
       throw new Error(
         'a positive --retry count must be specified when setting --retry-tag-filter'
@@ -217,7 +217,7 @@ const ArgvParser = {
 
     program.parse(argv)
     const options = program.opts() as IParsedArgvOptions
-    ArgvParser.validateRetryOptions(argv, options)
+    ArgvParser.validateRetryOptions(options)
 
     return {
       options,

From 0595d27922ab68314bd73b7ed3ec83a421c362f9 Mon Sep 17 00:00:00 2001
From: David Goss <dvdgoss@gmail.com>
Date: Sat, 22 Feb 2020 19:22:57 +0000
Subject: [PATCH 06/12] remove arg we dont need

---
 dist/cucumber.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dist/cucumber.js b/dist/cucumber.js
index c22addacb..5eeaa5d7f 100644
--- a/dist/cucumber.js
+++ b/dist/cucumber.js
@@ -73240,7 +73240,7 @@ function () {
       });
       program.parse(argv);
       var options = program.opts();
-      ArgvParser.validateRetryOptions(argv, options);
+      ArgvParser.validateRetryOptions(options);
       return {
         options: options,
         args: program.args

From eb91517555acadeb4e3701040ec2af8c10f5883a Mon Sep 17 00:00:00 2001
From: David Goss <dvdgoss@gmail.com>
Date: Thu, 27 Feb 2020 20:41:42 +0000
Subject: [PATCH 07/12] create a console from stdout and warn using that

---
 features/retry.feature                 |  2 +-
 features/step_definitions/cli_steps.ts |  5 -----
 features/support/world.ts              |  7 -------
 src/cli/index.ts                       | 11 ++++++-----
 4 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/features/retry.feature b/features/retry.feature
index e3ade658a..ba4183d8b 100644
--- a/features/retry.feature
+++ b/features/retry.feature
@@ -26,7 +26,7 @@ Feature: Retry flaky tests
       Given(/^a step$/, function() {})
       """
     When I run cucumber-js with `--retry 1 --retryTagFilter @flaky`
-    Then it issues the warning:
+    Then the output contains the text:
       """
       the argument --retryTagFilter is deprecated and will be removed in a future release; please use --retry-tag-filter
       """
diff --git a/features/step_definitions/cli_steps.ts b/features/step_definitions/cli_steps.ts
index c56600244..02843d5ab 100644
--- a/features/step_definitions/cli_steps.ts
+++ b/features/step_definitions/cli_steps.ts
@@ -57,11 +57,6 @@ Then(/^it fails$/, function(this: World) {
   this.verifiedLastRunError = true
 })
 
-Then(/^it issues the warning:$/, function(this: World, text: string) {
-  const warnings: string[] = this.lastRun.warnings
-  expect(warnings).to.include(text)
-})
-
 Then(/^it outputs the text:$/, function(this: World, text) {
   const actualOutput = normalizeText(this.lastRun.output)
   const expectedOutput = normalizeText(text)
diff --git a/features/support/world.ts b/features/support/world.ts
index 06134dfda..b5a416916 100644
--- a/features/support/world.ts
+++ b/features/support/world.ts
@@ -16,7 +16,6 @@ interface ILastRun {
   errorOutput: string
   envelopes: messages.IEnvelope[]
   output: string
-  warnings: string[]
 }
 
 interface IRunResult {
@@ -50,10 +49,6 @@ export class World {
         return arg
       })
     const cwd = this.tmpDir
-    const warnings: string[] = []
-    const warn = (message: string): void => {
-      warnings.push(message)
-    }
 
     let result: IRunResult
 
@@ -69,7 +64,6 @@ export class World {
         argv: args,
         cwd,
         stdout,
-        warn,
       })
       let error: any, stderr: string
       try {
@@ -111,7 +105,6 @@ export class World {
       errorOutput: result.stderr,
       envelopes,
       output: colors.strip(result.stdout),
-      warnings,
     }
     this.verifiedLastRunError = false
     expect(this.lastRun.output).to.not.include('Unhandled rejection')
diff --git a/src/cli/index.ts b/src/cli/index.ts
index 16ffe15a4..d989003eb 100644
--- a/src/cli/index.ts
+++ b/src/cli/index.ts
@@ -22,6 +22,7 @@ import { doesNotHaveValue } from '../value_checker'
 import Gherkin from 'gherkin'
 import { ISupportCodeLibrary } from '../support_code_library_builder/types'
 import { IParsedArgvFormatOptions } from './argv_parser'
+import { Console } from 'console'
 
 const { incrementing, uuid } = IdGenerator
 
@@ -42,13 +43,13 @@ export default class Cli {
   private readonly argv: string[]
   private readonly cwd: string
   private readonly stdout: IFormatterStream
-  private readonly warn: (message: string) => void
+  private readonly console: Console
 
-  constructor({ argv, cwd, stdout, warn = console.warn }) {
+  constructor({ argv, cwd, stdout }) {
     this.argv = argv
     this.cwd = cwd
     this.stdout = stdout
-    this.warn = warn
+    this.console = new Console(stdout)
   }
 
   async getConfiguration(): Promise<IConfiguration> {
@@ -65,7 +66,7 @@ export default class Cli {
 
   private lintArgv(fullArgv: string[]): void {
     if (fullArgv.includes('--retryTagFilter')) {
-      this.warn(
+      this.console.warn(
         'the argument --retryTagFilter is deprecated and will be removed in a future release; please use --retry-tag-filter'
       )
     }
@@ -100,7 +101,7 @@ export default class Cli {
       }
       if (type === 'progress-bar' && !(stream as TtyWriteStream).isTTY) {
         const outputToName = outputTo === '' ? 'stdout' : outputTo
-        this.warn(
+        this.console.warn(
           `Cannot use 'progress-bar' formatter for output to '${outputToName}' as not a TTY. Switching to 'progress' formatter.`
         )
         type = 'progress'

From a9dea8c033e2bc4f7b7ef486897b484f19a09e3e Mon Sep 17 00:00:00 2001
From: David Goss <dvdgoss@gmail.com>
Date: Sat, 7 Mar 2020 17:59:53 +0000
Subject: [PATCH 08/12] log warnings to stderr not stdout

---
 features/retry.feature    |  2 +-
 features/support/world.ts | 14 ++++++++++----
 src/cli/index.ts          |  4 ++--
 src/cli/run.ts            |  1 +
 4 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/features/retry.feature b/features/retry.feature
index ba4183d8b..95245284b 100644
--- a/features/retry.feature
+++ b/features/retry.feature
@@ -26,7 +26,7 @@ Feature: Retry flaky tests
       Given(/^a step$/, function() {})
       """
     When I run cucumber-js with `--retry 1 --retryTagFilter @flaky`
-    Then the output contains the text:
+    Then the error output contains the text:
       """
       the argument --retryTagFilter is deprecated and will be removed in a future release; please use --retry-tag-filter
       """
diff --git a/features/support/world.ts b/features/support/world.ts
index b5a416916..ad751fc79 100644
--- a/features/support/world.ts
+++ b/features/support/world.ts
@@ -60,25 +60,31 @@ export class World {
       })
     } else {
       const stdout = new PassThrough()
+      const stderr = new PassThrough()
       const cli = new Cli({
         argv: args,
         cwd,
         stdout,
+        stderr,
       })
-      let error: any, stderr: string
+      let error: any
       try {
         const { success } = await cli.run()
         if (!success) {
           error = new Error('CLI exited with non-zero')
           error.code = 42
         }
-        stderr = ''
       } catch (err) {
         error = err
-        stderr = VError.fullStack(error)
+        stderr.write(VError.fullStack(error))
       }
       stdout.end()
-      result = { error, stdout: await toString(stdout), stderr }
+      stderr.end()
+      result = {
+        error,
+        stdout: await toString(stdout),
+        stderr: await toString(stderr),
+      }
     }
     const envelopes: messages.Envelope[] = []
     const messageOutputPath = path.join(cwd, messageFilename)
diff --git a/src/cli/index.ts b/src/cli/index.ts
index d989003eb..ee32df28a 100644
--- a/src/cli/index.ts
+++ b/src/cli/index.ts
@@ -45,11 +45,11 @@ export default class Cli {
   private readonly stdout: IFormatterStream
   private readonly console: Console
 
-  constructor({ argv, cwd, stdout }) {
+  constructor({ argv, cwd, stdout, stderr }) {
     this.argv = argv
     this.cwd = cwd
     this.stdout = stdout
-    this.console = new Console(stdout)
+    this.console = new Console(stderr)
   }
 
   async getConfiguration(): Promise<IConfiguration> {
diff --git a/src/cli/run.ts b/src/cli/run.ts
index 7f238d66c..b2370c37a 100644
--- a/src/cli/run.ts
+++ b/src/cli/run.ts
@@ -12,6 +12,7 @@ export default async function run(): Promise<void> {
     argv: process.argv,
     cwd,
     stdout: process.stdout,
+    stderr: process.stderr,
   })
 
   let result: ICliRunResult

From 3dc5293442792a51df521668b8a1ce9bdbbfbf13 Mon Sep 17 00:00:00 2001
From: David Goss <dvdgoss@gmail.com>
Date: Sat, 7 Mar 2020 19:06:35 +0000
Subject: [PATCH 09/12] pass both stdout and stderr to console

---
 src/cli/index.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cli/index.ts b/src/cli/index.ts
index ee32df28a..3566c0920 100644
--- a/src/cli/index.ts
+++ b/src/cli/index.ts
@@ -49,7 +49,7 @@ export default class Cli {
     this.argv = argv
     this.cwd = cwd
     this.stdout = stdout
-    this.console = new Console(stderr)
+    this.console = new Console({ stdout, stderr })
   }
 
   async getConfiguration(): Promise<IConfiguration> {

From 2fdd09467b96a4d94733762455cfa7b629e2a700 Mon Sep 17 00:00:00 2001
From: David Goss <dvdgoss@gmail.com>
Date: Fri, 13 Mar 2020 07:23:21 +0000
Subject: [PATCH 10/12] rework again, do linting in argv parser

---
 features/retry.feature           |  1 +
 features/support/world.ts        |  1 -
 src/cli/argv_parser.ts           |  8 ++++++++
 src/cli/configuration_builder.ts |  1 +
 src/cli/index.ts                 | 16 +---------------
 src/cli/run.ts                   |  1 -
 6 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/features/retry.feature b/features/retry.feature
index 95245284b..33b3bf99a 100644
--- a/features/retry.feature
+++ b/features/retry.feature
@@ -12,6 +12,7 @@ Feature: Retry flaky tests
       """
     And it fails
 
+  @spawn
   Scenario: running Cucumber JS with --retryTagFilter in camel case will result in a warning
     Given a file named "features/a.feature" with:
       """
diff --git a/features/support/world.ts b/features/support/world.ts
index ad751fc79..c24e1e2ab 100644
--- a/features/support/world.ts
+++ b/features/support/world.ts
@@ -65,7 +65,6 @@ export class World {
         argv: args,
         cwd,
         stdout,
-        stderr,
       })
       let error: any
       try {
diff --git a/src/cli/argv_parser.ts b/src/cli/argv_parser.ts
index 3d394c6b9..81c61b329 100644
--- a/src/cli/argv_parser.ts
+++ b/src/cli/argv_parser.ts
@@ -224,6 +224,14 @@ const ArgvParser = {
       args: program.args,
     }
   },
+
+  lint(fullArgv: string[]): void {
+    if (fullArgv.includes('--retryTagFilter')) {
+      console.warn(
+        'the argument --retryTagFilter is deprecated and will be removed in a future release; please use --retry-tag-filter'
+      )
+    }
+  },
 }
 
 export default ArgvParser
diff --git a/src/cli/configuration_builder.ts b/src/cli/configuration_builder.ts
index 974ee6aa7..5e61f40ec 100644
--- a/src/cli/configuration_builder.ts
+++ b/src/cli/configuration_builder.ts
@@ -55,6 +55,7 @@ export default class ConfigurationBuilder {
   constructor({ argv, cwd }: INewConfigurationBuilderOptions) {
     this.cwd = cwd
 
+    ArgvParser.lint(argv)
     const parsedArgv = ArgvParser.parse(argv)
     this.args = parsedArgv.args
     this.options = parsedArgv.options
diff --git a/src/cli/index.ts b/src/cli/index.ts
index 8e352afd0..94d2d4e16 100644
--- a/src/cli/index.ts
+++ b/src/cli/index.ts
@@ -22,7 +22,6 @@ import { doesNotHaveValue } from '../value_checker'
 import Gherkin from 'gherkin'
 import { ISupportCodeLibrary } from '../support_code_library_builder/types'
 import { IParsedArgvFormatOptions } from './argv_parser'
-import { Console } from 'console'
 import { WriteStream } from 'fs'
 
 const { incrementing, uuid } = IdGenerator
@@ -50,23 +49,19 @@ export default class Cli {
   private readonly argv: string[]
   private readonly cwd: string
   private readonly stdout: IFormatterStream
-  private readonly console: Console
 
   constructor({
     argv,
     cwd,
     stdout,
-    stderr,
   }: {
     argv: string[]
     cwd: string
     stdout: IFormatterStream
-    stderr: IFormatterStream
   }) {
     this.argv = argv
     this.cwd = cwd
     this.stdout = stdout
-    this.console = new Console({ stdout, stderr })
   }
 
   async getConfiguration(): Promise<IConfiguration> {
@@ -74,21 +69,12 @@ export default class Cli {
       argv: this.argv,
       cwd: this.cwd,
     })
-    this.lintArgv(fullArgv)
     return ConfigurationBuilder.build({
       argv: fullArgv,
       cwd: this.cwd,
     })
   }
 
-  private lintArgv(fullArgv: string[]): void {
-    if (fullArgv.includes('--retryTagFilter')) {
-      this.console.warn(
-        'the argument --retryTagFilter is deprecated and will be removed in a future release; please use --retry-tag-filter'
-      )
-    }
-  }
-
   async initializeFormatters({
     eventBroadcaster,
     eventDataCollector,
@@ -118,7 +104,7 @@ export default class Cli {
       }
       if (type === 'progress-bar' && !(stream as TtyWriteStream).isTTY) {
         const outputToName = outputTo === '' ? 'stdout' : outputTo
-        this.console.warn(
+        console.warn(
           `Cannot use 'progress-bar' formatter for output to '${outputToName}' as not a TTY. Switching to 'progress' formatter.`
         )
         type = 'progress'
diff --git a/src/cli/run.ts b/src/cli/run.ts
index b2370c37a..7f238d66c 100644
--- a/src/cli/run.ts
+++ b/src/cli/run.ts
@@ -12,7 +12,6 @@ export default async function run(): Promise<void> {
     argv: process.argv,
     cwd,
     stdout: process.stdout,
-    stderr: process.stderr,
   })
 
   let result: ICliRunResult

From 6ee7526de0c6c286ecfdb37674c5f891b4fa25f4 Mon Sep 17 00:00:00 2001
From: David Goss <dvdgoss@gmail.com>
Date: Tue, 17 Mar 2020 01:00:00 +0000
Subject: [PATCH 11/12] simplify

---
 features/support/world.ts | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/features/support/world.ts b/features/support/world.ts
index c24e1e2ab..b5a416916 100644
--- a/features/support/world.ts
+++ b/features/support/world.ts
@@ -60,30 +60,25 @@ export class World {
       })
     } else {
       const stdout = new PassThrough()
-      const stderr = new PassThrough()
       const cli = new Cli({
         argv: args,
         cwd,
         stdout,
       })
-      let error: any
+      let error: any, stderr: string
       try {
         const { success } = await cli.run()
         if (!success) {
           error = new Error('CLI exited with non-zero')
           error.code = 42
         }
+        stderr = ''
       } catch (err) {
         error = err
-        stderr.write(VError.fullStack(error))
+        stderr = VError.fullStack(error)
       }
       stdout.end()
-      stderr.end()
-      result = {
-        error,
-        stdout: await toString(stdout),
-        stderr: await toString(stderr),
-      }
+      result = { error, stdout: await toString(stdout), stderr }
     }
     const envelopes: messages.Envelope[] = []
     const messageOutputPath = path.join(cwd, messageFilename)

From dae8a70ec87e8a2af9d450000990fbf507bfa4c8 Mon Sep 17 00:00:00 2001
From: David Goss <dvdgoss@gmail.com>
Date: Tue, 17 Mar 2020 08:03:16 +0000
Subject: [PATCH 12/12] update CHANGELOG.md

---
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index bad2f14e8..29b4fa2b2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO
 #### Bug fixes
 
 * don't execute BeforeAll and AfterAll hooks when in dry-run
+* support correct case for `--retry-tag-filter` CLI argument
 
 ### [6.0.5](https://github.com/cucumber/cucumber-js/compare/v6.0.4...v6.0.5) (2019-11-13)