Skip to content

[🐛 Bug]: Cannot run WDIO Launcher programmatically  #10585

@dukhanov

Description

@dukhanov

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

8.11.2

Node.js Version

v18.16.0

Mode

WDIO Testrunner

Which capabilities are you using?

Default capabilities

What happened?

Using Launcher from version 8 does not work as it was before in V7:

image

What is your expected behavior?

Installed WDIO from scratch and tried to start runner programmatically from JS:

const Launcher = require('@wdio/cli').Launcher

const wdio = new Launcher('./wdio.conf.js')
wdio.run().then(
    () => process.exit(0),
    (e) => { console.warn(e); process.exit(1) }
)

And I have an error:

TypeError: Cannot read properties of undefined (reading 'run')
    at Launcher.run (/Users/Solutions/playground/wdiocli/node_modules/@wdio/cli/build/cjs/index.js:17:34)
    at Object.<anonymous> (/Users/Solutions/playground/wdiocli/main.js:4:6)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47

How to reproduce the bug.

const Launcher = require('@wdio/cli').Launcher

const wdio = new Launcher('./wdio.conf.js')
wdio.run().then(
    () => process.exit(0),
    (e) => { console.warn(e); process.exit(1) }
)

Relevant log output

TypeError: Cannot read properties of undefined (reading 'run')
    at Launcher.run (/Users/Solutions/playground/wdiocli/node_modules/@wdio/cli/build/cjs/index.js:17:34)
    at Object.<anonymous> (/Users/Solutions/playground/wdiocli/main.js:4:6)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47

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

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions