WebdriverIO SevereServiceErrror not stopping the test run

917 views Asked by At

I have setup a custom wdio service (as per the documentation) which is used to create a build for the Angles automation dashboard.

As part of this service I want to use the SevereServiceError when it is unable to create the build and stop the run. However in my example test it throws the error and simply continues the test run. See logs here:

2022-03-05T07:28:36.936Z INFO @wdio/cli:launcher: Run onPrepare hook
2022-03-05T07:28:36.936Z INFO chromedriver: Start Chromedriver (/git/angles/webdriverio-example/node_modules/chromedriver/lib/chromedriver/chromedriver) with args --port=9515 --url-base=/
2022-03-05T07:28:36.982Z ERROR @wdio/cli:utils: A service failed in the 'onPrepare' hook
SevereServiceError: Unable to create a build due to connect ECONNREFUSED 127.0.0.1:3000.
    at /Users/sergios/Documents/git/angles/webdriverio-example/node_modules/angles-wdio-reporter/src/integrations/wdio/AnglesWDIOService.ts:57:15
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async /Users/sergios/Documents/git/angles/webdriverio-example/node_modules/@wdio/cli/build/utils.js:28:17
    at async Promise.all (index 1)
    at async Launcher.run (/Users/sergios/Documents/git/angles/webdriverio-example/node_modules/@wdio/cli/build/launcher.js:86:13)

Continue...
2022-03-05T07:28:36.985Z INFO chromedriver: Starting ChromeDriver 98.0.4758.102 (273bf7ac8c909cde36982d27f66f3c70846a3718-refs/branch-heads/4758@{#1151}) on port 9515
2022-03-05T07:28:36.987Z INFO chromedriver: Only local connections are allowed.

You can run the example yourself by cloning the example repo and running npm run test.

NOTE: This should fail because it's looking for a local instance of the Angles dashboard.

Any ideas why the SevereServiceError isn't stopping the test run?

1

There are 1 answers

0
sergionb On BEST ANSWER

By updating wdio dependencies and ts-node and typescript to current versions this issue has been resolved. The test run now stops when the SeverServiceError is thrown.