Skip to content

[🐛 Bug]: CustomService is run twice #12428

@tdomzalski

Description

@tdomzalski

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

8.32.4

Node.js Version

18

Mode

Standalone Mode

Which capabilities are you using?

n/a

What happened?

I run the Launcher with custom service from external script (please see the code here: https://github.com/tdomzalski/wdio-customservice-test).
The problem: when I execute node main.js the service is being executed twice (see the logs displayed in console: constructor and service's methods are executed twice).

Furthermore I get the following error in wdio-0-0.log file and browser is not run:

2024-03-04T16:07:24.106Z INFO @wdio/local-runner: Run worker command: run
2024-03-04T16:07:24.135Z ERROR @wdio/local-runner: Failed launching test session: TypeError: Cannot read properties of null (reading 'before')
    at ConfigParser.addService (file:///C:/WORKS/wdio-customservice-test/node_modules/@wdio/config/build/node/ConfigParser.js:207:43)
    at Array.map (<anonymous>)
    at Runner.run (file:///C:/WORKS/wdio-customservice-test/node_modules/@wdio/runner/build/index.js:75:89)

What is your expected behavior?

The service should be run only once.
The browser should be executed and tests executed.

How to reproduce the bug.

Please see the code here: https://github.com/tdomzalski/wdio-customservice-test

Relevant log output

C:\WORKS\wdio-customservice-test>node main.js

Execution of 1 workers started at 2024-03-04T16:07:14.828Z

MyService constructor { timestamp: 1709568434789 }
MyService constructor { timestamp: 1709568434789 }
MyService onPrepare
MyService onPrepare
onWorkerStart [ 'file:///C:/WORKS/wdio-customservice-test/test/mytest.spec.js' ]
[0-0] FAILED
onWorkerEnd
MyService onComplete
MyService onComplete

Spec Files:      0 passed, 1 failed, 1 total (100% completed) in 00:00:11

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

    Bug 🐛help wantedIssues that are free to take by anyone interested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions