webdriverio: [๐Ÿ› Bug]: Run project after WDIO init for Cucumber fails

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

8

Node.js Version

v16.18.1

Mode

WDIO Testrunner

Which capabilities are you using?

capabilities: [
    {
      maxInstances: 5,
      //
      browserName: 'chrome',
      acceptInsecureCerts: true,
    },
  ],

What happened?

I wanted to set up a new project for CucumberJS with npm init wdio .. Iโ€™ve installed all needed dependencies through the cli, see below

===============================
๐Ÿค– WDIO Configuration Wizard ๐Ÿง™
===============================

? A project named "webdriverio-tests" was detected at "/Users/wimselles/Sauce/Git/wdio-samples/wdio-cucumber-v6-v7-v8/demo", correct? Yes
? Where should your tests be launched? local - for e2e testing of web and mobile applications
? Where is your automation backend located? On my local machine
? Which framework do you want to use? Cucumber (https://cucumber.io/)
? Do you want to use a compiler? No!
? Do you want WebdriverIO to autogenerate some test files? Yes
? Where should these feature files be located? /Users/wimselles/Sauce/Git/wdio-samples/wdio-cucumber-v6-v7-v8/demo/features/**/*.feature
? Where should these step definitions be located? 
/Users/wimselles/Sauce/Git/wdio-samples/wdio-cucumber-v6-v7-v8/demo/features/step-definitions/steps.js
? Do you want to use page objects (https://martinfowler.com/bliki/PageObject.html)? No
? Which reporter do you want to use? spec
? Do you want to add a plugin to your test setup? 
? Do you want to add a service to your test setup? chromedriver
? What is the base url? http://localhost
? Do you want me to run `npm install` Yes


Installing wdio packages:
- @wdio/local-runner@latest
- @wdio/cucumber-framework@latest
- @wdio/spec-reporter@latest
- wdio-chromedriver-service
- chromedriver

After running the project with npm run wdio it fails

What is your expected behavior?

No response

How to reproduce the bug.

See โ€œWhat happenedโ€

Relevant log output

npm run wdio --logLevel=debug
npm WARN config init.license Use `--init-license` instead.

> webdriverio-tests@0.1.0 wdio
> wdio run wdio.conf.js

(โ ‚โ ‚โ ‚โ ‚โ ‚โ ‚โ ‚โ ‚โ ‚โ ‚โ ‚โ ‚โ ‚โ ‚โ ‚โ ‚โ ‚โ ‚) โ ฆ : timing config:load:flatten Completed in 4ms
Execution of 1 workers started at 2022-12-06T09:47:32.281Z

2022-12-06T09:47:32.296Z INFO @wdio/cli:launcher: Run onPrepare hook
2022-12-06T09:47:32.315Z INFO chromedriver: Initiate Chromedriver Launcher (v8.0.1)
2022-12-06T09:47:32.317Z INFO chromedriver: Start Chromedriver (/Users/wimselles/Sauce/Git/wdio-samples/wdio-cucumber-v6-v7-v8/demo/node_modules/chromedriver/lib/chromedriver/chromedriver) with args --port=9515 --url-base=/
2022-12-06T09:47:32.343Z INFO chromedriver: Starting ChromeDriver 108.0.5359.71 (1e0e3868ee06e91ad636a874420e3ca3ae3756ac-refs/branch-heads/5359@{#1016}) on port 9515
2022-12-06T09:47:32.344Z INFO chromedriver: Only local connections are allowed.
2022-12-06T09:47:32.345Z INFO chromedriver: Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
2022-12-06T09:47:32.347Z INFO chromedriver: ChromeDriver was started successfully.
2022-12-06T09:47:32.449Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2022-12-06T09:47:32.451Z INFO @wdio/local-runner: Start worker 0-0 with arg: run,wdio.conf.js
[0-0] Error [ERR_LOADER_CHAIN_INCOMPLETE]: "ts-node/esm/transpile-only 'resolve'" did not call the next hook in its chain and did not explicitly signal a short circuit. If this is intentional, include `shortCircuit: true` in the hook's return.
[0-0]     at new NodeError (node:internal/errors:387:5)
[0-0]     at ESMLoader.resolve (node:internal/modules/esm/loader:845:13)
[0-0]     at async ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:7)
[0-0]     at async Promise.all (index 0)
[0-0]     at async ESMLoader.import (node:internal/modules/esm/loader:526:24)
[0-0]     at async loadESM (node:internal/process/esm_loader:91:5)
[0-0]     at async handleMainPromise (node:internal/modules/run_main:65:12) {
[0-0]   code: 'ERR_LOADER_CHAIN_INCOMPLETE'
[0-0] }
[0-0] FAILED
2022-12-06T09:47:32.742Z INFO @wdio/cli:launcher: Run onWorkerEnd hook
2022-12-06T09:47:32.743Z INFO @wdio/cli:launcher: Run onComplete hook

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

2022-12-06T09:47:32.745Z INFO @wdio/local-runner: Shutting down spawned worker
2022-12-06T09:47:32.997Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2022-12-06T09:47:32.999Z INFO @wdio/local-runner: shutting down

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

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (13 by maintainers)

Most upvoted comments

Faced the same problem Resolved the problem by adding log here:

https://github.com/webdriverio/webdriverio/pull/12437/files#diff-b2370c9a4da40878414e77aa08bf316bc6667733650fbc8bab5ee41cee5f1dc3R31

const loaderPath = await resolve('ts-node/esm/transpile-only.mjs', import.meta.url);
console.log(loaderPath);

In loaderPath was a strange forgotten old wdio node_modules folder Not at the current project path ๐Ÿ™ˆ

Removed this folder resolved the issue