Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to start vscode with wdio runner #91

Closed
mikhail-g opened this issue Nov 15, 2023 · 3 comments
Closed

Unable to start vscode with wdio runner #91

mikhail-g opened this issue Nov 15, 2023 · 3 comments

Comments

@mikhail-g
Copy link
Contributor

The installation wizard doesn't produce working code, while the documentation doesn't has a workaround on how to fix it

Environment

OS: macOS Ventura Version 13.5.2 (22G91)
node version: 16.16.0

Steps to reproduce:

  1. Clone the repo https://github.com/mikhail-g/wdio-vsce-test-issue or install by running npm create wdio@latest ./ and select the next options:
    ? What type of testing would you like to do? VS Code Extension Testing https://webdriver.io/docs/vscode-extension-testing
    ? Which framework do you want to use? Mocha (https://mochajs.org/)
    ? Do you want to use a compiler? TypeScript (https://www.typescriptlang.org/)
    ? Do you want WebdriverIO to autogenerate some test files? Yes
    ? What should be the location of your spec files? /Users/My_User/dev/wdio-vsce-test-issue/test/specs/**/*.ts
    ? 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? vscode
    ? Do you want me to run npm install Yes
  2. run npm i
  3. run npm run wdio

Actual result:

There is an error on Wdio srtart:

ERROR @wdio/config:ConfigParser: Failed loading configuration file: file:///Users/My_User/dev/wdio-vsce-test-issue/wdio.conf.ts: __dirname is not defined in ES module scope
ReferenceError: __dirname is not defined in ES module scope

After fixing it (see 2nd commit) there's another error for which I didn't find a fix or a workaround yet:

wdio run ./wdio.conf.ts

Execution of 1 workers started at ...

INFO @wdio/local-runner: Shutting down spawned worker
INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
INFO @wdio/local-runner: shutting down
Error: Error: Failed to initilialise launcher service unknown: Error: Couldn't initialise "wdio-vscode-service".
TypeError: Cannot destructure property 'URI' of '(intermediate value).default' as it is undefined.
    at file:///Users/My_User/dev/wdio-vsce-test-issue/node_modules/wdio-vscode-service/src/server/utils.ts:6:9
    at safeImport (file:///Users/My_User/dev/wdio-vsce-test-issue/node_modules/@wdio/utils/build/utils.js:223:15)
    at async initialisePlugin (file:///Users/My_User/dev/wdio-vsce-test-issue/node_modules/@wdio/utils/build/initialisePlugin.js:31:20)
    at async initialiseServices (file:///Users/My_User/dev/wdio-vsce-test-issue/node_modules/@wdio/utils/build/initialiseServices.js:53:25)
    at async initialiseLauncherService (file:///Users/My_User/dev/wdio-vsce-test-issue/node_modules/@wdio/utils/build/initialiseServices.js:81:26)
    at async Launcher.run (file:///Users/My_User/dev/wdio-vsce-test-issue/node_modules/@wdio/cli/build/launcher.js:85:65)
    at initialiseLauncherService (file:///Users/My_User/dev/wdio-vsce-test-issue/node_modules/@wdio/utils/build/initialiseServices.js:118:15)
    at async Launcher.run (file:///Users/My_User/dev/wdio-vsce-test-issue/node_modules/@wdio/cli/build/launcher.js:85:65)

Expected result:

  1. Wdio has started successfully
  2. The generated example test is running
  3. See the message in console:
> wdio run ./test/wdio.conf.ts

Execution of 1 workers started at ...

2023-11-15T17:36:19.827Z DEBUG @wdio/utils:initialiseServices: initialise service "vscode" as NPM package
2023-11-15T17:36:20.837Z INFO chromedriver: Initiate Chromedriver Launcher (v8.1.1)
2023-11-15T17:36:20.837Z INFO @wdio/cli:launcher: Run onPrepare hook
@christian-bromann
Copy link
Contributor

Thanks for reporting. This seems to be a duplicate of #88

@mikhail-g
Copy link
Contributor Author

proposed the solution at: #88 (comment)

@mikhail-g
Copy link
Contributor Author

mikhail-g commented Nov 15, 2023

hey @christian-bromann do you remember why you made this change 1562cd1? This seems to be a cause of this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants