Skip to content

[🐛 Bug]: mochaOpts.bail from CLI will be ignored  #11266

@nils-hoyer

Description

@nils-hoyer

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

latest

Node.js Version

18

Mode

WDIO Testrunner

Which capabilities are you using?

automationProtocol: 'devtools',
services: ['devtools'],
maxInstances: 1,
bail: 1,
framework: 'mocha',
mochaOpts: {
    bail: true,
    timeout: 60000,
},

What happened?

List of supported mocha options for wdio.conf.js
ref: https://webdriver.io/de/docs/frameworks/#mocha-optionen

List of wdio run options für cli e.g. mochaOpts
ref: https://webdriver.io/docs/testrunner/#wdio-run

Assuming the supported mocha options also work as cli parameter. I could not find any other documentation against this assumption.

GIVEN set mochaOpts.bail:true in wdio.conf.js
WHEN running wdio run ./wdio.conf.js --mochaOpts.bail false
THEN webdriverio is still bailing after the first test meaning it('testname' () => {}) 
-> Expected webdriverio is not bailing

The following workaround seems to work but only accept bail not other or multiple options:

GIVEN set mochaOpts.bail:true in wdio.conf.js
WHEN running wdio run ./wdio.conf.js --mochaOpts {bail:false}
THEN webdriverio is not bailing

What is your expected behavior?

From what I can read in the documentation, I would expect to be able to parse all supported mocha options from the CLI.

possible implementation:
wdio run ./wdio.conf.js --mochaOpts {bail:false,timeout:60000}
wdio run ./wdio.conf.js --mochaOpts.bail false --mochaOpts.timeout 60000

How to reproduce the bug.

Relevant log output

-

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions