Skip to content

regression bug: command line reporter-options parameter doesn't override mocha.opts #3951

@stalb

Description

@stalb

Prerequisites

  • Checked that your issue hasn't already been filed by cross-referencing issues with the faq label
  • Checked next-gen ES issues and syntax problems by using the same environment and/or transpiler configuration without Mocha to ensure it isn't just a feature that actually isn't supported in the environment in question or a bug in your code.
  • 'Smoke tested' the code to be tested by running it outside the real test suite to get a better sense of whether the problem is in the code under test, your usage of Mocha, or Mocha itself
  • Ensured that there is no discrepancy between the locally and globally installed versions of Mocha. You can find them with: node node_modules/.bin/mocha --version(Local) and mocha --version(Global). We recommend that you not install Mocha globally.

Description

Mocha doesn't override reporter-options value defined in mocha.opts with the one defined on command line.

Steps to Reproduce

  1. Define a mocha.ops file with reporter-options:
--recursive
--reporter=xunit
--reporter-options output=./test-reports/junit.xml
  1. Call mocha using a different value for reporter-option
node node_modules/mocha/bin/mocha --reporter-options output=./test-reports/unit.xml
  1. Verify that mocha has created ./test-reports/junit.xml and not ./test-reports/unit.xml

Expected behavior: [What you expect to happen]

Mocha should use the reporter-options specified on the command-line instead of the one defined in mocha.opts.

Actual behavior: [What actually happens]

Mocha use the reporter-options defined in mocha.opts instead of the one specified on the command-line.

Reproduces how often: [What percentage of the time does it reproduce?]
100%

Versions

  • mocha: 6.0.0-6.1.4 (works fine with version 5.2.0) -- mocha is not installed globally
  • node: 8.14.1 / 10.15.3 / 12.4.0
  • Your operating system
    • name and version: windows 10 1903 / debian stretch
    • architecture (32 or 64-bit): 64bit
  • Your shell (e.g., bash, zsh, PowerShell, cmd): PowerShell / bash

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidnot something we need to work on, such as a non-reproducing issue or an external root cause

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions