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

[🐛 Bug]: Browser runner throw error if use pnpm to install dependencies. #8

Open
3 tasks done
zzzze opened this issue Jun 4, 2023 · 0 comments
Open
3 tasks done
Labels
help wanted Extra attention is needed

Comments

@zzzze
Copy link

zzzze commented Jun 4, 2023

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

v8.8.4

Node.js Version

v18.12.0

Mode

WDIO Testrunner

Which capabilities are you using?

{
  browserName: 'chrome',
  browserVersion: 'Version 114.0.5735.90 (Official Build) (arm64)',
  platformName: 'MacOS 13.0.1'
}

What happened?

Browser runner throw error if use pnpm to install dependencies. If use npm, it works fine.

What is your expected behavior?

It should works fine with pnpm.

How to reproduce the bug.

  1. Pull the following repo.
    https://github.com/webdriverio/component-testing-examples/commit/67140843eb6a378fdcde7f1b057da39bcb3f27ed
  2. cd into to react-typescript-vite
  3. Install by pnpm
  4. Run test and it will fail.

Relevant log output

> react-typescript-vite@0.0.0 wdio /Users/xxx/code/github.com/component-testing-examples/react-typescript-vite
> wdio run ./wdio.conf.ts


Execution of 1 workers started at 2023-06-04T04:39:12.776Z

2023-06-04T04:39:13.449Z INFO @wdio/browser-runner:ViteServer: Capturing test coverage enabled
2023-06-04T04:39:13.712Z INFO chromedriver: Initiate Chromedriver Launcher (v8.1.1)
2023-06-04T04:39:13.713Z INFO @wdio/browser-runner: Initiate browser environment
2023-06-04T04:39:13.794Z INFO @wdio/browser-runner:ViteServer: Vite server started successfully on port 49158, root directory: /Users/xxx/code/github.com/component-testing-examples/react-typescript-vite
2023-06-04T04:39:13.798Z INFO @wdio/cli:launcher: Run onPrepare hook
2023-06-04T04:39:13.800Z INFO chromedriver: Start Chromedriver (/Users/xxx/code/github.com/component-testing-examples/react-typescript-vite/node_modules/.pnpm/chromedriver@114.0.1/node_modules/chromedriver/lib/chromedriver/chromedriver) with args --port=9515 --url-base=/
2023-06-04T04:39:13.948Z INFO chromedriver: Starting ChromeDriver 114.0.5735.90 (386bc09e8f4f2e025eddae123f36f6263096ae49-refs/branch-heads/5735@{#1052}) on port 9515
2023-06-04T04:39:13.948Z INFO chromedriver: Only local connections are allowed.
2023-06-04T04:39:13.948Z INFO chromedriver: Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
2023-06-04T04:39:13.948Z INFO chromedriver: ChromeDriver was started successfully.
2023-06-04T04:39:14.017Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2023-06-04T04:39:14.018Z INFO @wdio/local-runner: Start worker 0-0 with arg: run,./wdio.conf.ts
[0-0] 2023-06-04T04:39:14.625Z INFO @wdio/local-runner: Run worker command: run
[0-0] RUNNING in chrome - file:///src/tests/LoginForm.test.tsx
[0-0] 2023-06-04T04:39:15.023Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-0] 2023-06-04T04:39:15.090Z INFO webdriver: [POST] http://localhost:9515/session
[0-0] 2023-06-04T04:39:15.090Z INFO webdriver: DATA {
[0-0]   capabilities: { alwaysMatch: { browserName: 'chrome' }, firstMatch: [ {} ] },
[0-0]   desiredCapabilities: { browserName: 'chrome' }
[0-0] }
[0-0] 2023-06-04T04:39:15.803Z INFO @wdio/runner: Run spec file file:///Users/xxx/code/github.com/component-testing-examples/react-typescript-vite/src/tests/LoginForm.test.tsx for cid 0-0
[0-0] 2023-06-04T04:39:15.804Z INFO webdriver: COMMAND navigateTo("http://localhost:49158/?cid=0-0&spec=/Users/xxx/code/github.com/component-testing-examples/react-typescript-vite/src/tests/LoginForm.test.tsx")
[0-0] 2023-06-04T04:39:15.804Z INFO webdriver: [POST] http://localhost:9515/session/a7c458538ac1dcad44293925dd1b3f3b/url
[0-0] 2023-06-04T04:39:15.804Z INFO webdriver: DATA {
[0-0]   url: 'http://localhost:49158/?cid=0-0&spec=/Users/xxx/code/github.com/component-testing-examples/react-typescript-vite/src/tests/LoginForm.test.tsx'
[0-0] }
2023-06-04T04:39:15.859Z INFO @wdio/browser-runner:plugin: Received request for: /?cid=0-0&spec=/Users/xxx/code/github.com/component-testing-examples/react-typescript-vite/src/tests/LoginForm.test.tsx
2023-06-04T04:39:15.896Z INFO @wdio/browser-runner:plugin: Received request for: /node_modules/mocha/mocha.js
2023-06-04T04:39:15.896Z ERROR @wdio/browser-runner:plugin: No environment found for non determined environment
[0-0] 2023-06-04T04:39:16.750Z INFO webdriver: RESULT null
[0-0] 2023-06-04T04:39:16.750Z INFO webdriver: COMMAND addCookie(<object>)
[0-0] 2023-06-04T04:39:16.750Z INFO webdriver: [POST] http://localhost:9515/session/a7c458538ac1dcad44293925dd1b3f3b/cookie
[0-0] 2023-06-04T04:39:16.750Z INFO webdriver: DATA {
[0-0]   cookie: {
[0-0]     name: 'WDIO_SPEC',
[0-0]     value: '/Users/xxx/code/github.com/component-testing-examples/react-typescript-vite/src/tests/LoginForm.test.tsx'
[0-0]   }
[0-0] }
[0-0] 2023-06-04T04:39:16.754Z INFO webdriver: RESULT null
[0-0] 2023-06-04T04:39:16.755Z INFO webdriver: COMMAND addCookie(<object>)
[0-0] 2023-06-04T04:39:16.755Z INFO webdriver: [POST] http://localhost:9515/session/a7c458538ac1dcad44293925dd1b3f3b/cookie
[0-0] 2023-06-04T04:39:16.755Z INFO webdriver: DATA { cookie: { name: 'WDIO_CID', value: '0-0' } }
[0-0] 2023-06-04T04:39:16.758Z INFO webdriver: RESULT null
[0-0] 2023-06-04T04:39:16.859Z INFO webdriver: COMMAND executeScript(<fn>, <object>)
[0-0] 2023-06-04T04:39:16.860Z INFO webdriver: [POST] http://localhost:9515/session/a7c458538ac1dcad44293925dd1b3f3b/execute/sync
[0-0] 2023-06-04T04:39:16.860Z INFO webdriver: DATA { script: 'fetchExecutionState(...) [1409 bytes]', args: [] }
[0-0] 2023-06-04T04:39:16.864Z INFO webdriver: RESULT {
[0-0]   errors: [
[0-0]     {
[0-0]       error: "SyntaxError: The requested module '/node_modules/.pnpm/[email protected]/node_modules/expect/build/index.js?v=13df7e62' does not provide an export named 'expect'",
[0-0]       filename: 'http://localhost:49158/node_modules/.pnpm/[email protected][email protected]/node_modules/expect-webdriverio/lib/index.js',
[0-0]       message: "Uncaught SyntaxError: The requested module '/node_modules/.pnpm/[email protected]/node_modules/expect/build/index.js?v=13df7e62' does not provide an export named 'expect'"
[0-0]     }
[0-0]   ],
[0-0]   failures: null,
[0-0]   hasViteError: false
[0-0] }
[0-0] 2023-06-04T04:39:16.865Z INFO webdriver: COMMAND executeScript("return (() => (window.__coverage__ || {})).apply(null, arguments)", <object>)
[0-0] 2023-06-04T04:39:16.865Z INFO webdriver: [POST] http://localhost:9515/session/a7c458538ac1dcad44293925dd1b3f3b/execute/sync
[0-0] 2023-06-04T04:39:16.865Z INFO webdriver: DATA {
[0-0]   script: 'return (() => (window.__coverage__ || {})).apply(null, arguments)',
[0-0]   args: []
[0-0] }
[0-0] 2023-06-04T04:39:16.869Z INFO webdriver: RESULT {}
[0-0]  Error:  Test failed due to following error(s):
  - index.js: Uncaught SyntaxError: The requested module '/node_modules/.pnpm/[email protected]/node_modules/expect/build/index.js?v=13df7e62' does not provide an export named 'expect'

[0-0] 2023-06-04T04:39:16.871Z INFO webdriver: COMMAND deleteSession()
[0-0] 2023-06-04T04:39:16.871Z INFO webdriver: [DELETE] http://localhost:9515/session/a7c458538ac1dcad44293925dd1b3f3b
[0-0] 2023-06-04T04:39:16.926Z INFO webdriver: RESULT null
[0-0] FAILED in chrome - file:///src/tests/LoginForm.test.tsx
2023-06-04T04:39:17.035Z INFO @wdio/cli:launcher: Run onWorkerEnd hook
2023-06-04T04:39:17.035Z INFO @wdio/cli:launcher: Run onComplete hook

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

2023-06-04T04:39:17.036Z INFO @wdio/local-runner: Shutting down spawned worker
2023-06-04T04:39:17.286Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2023-06-04T04:39:17.286Z INFO @wdio/local-runner: shutting down
----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------|---------|----------|---------|---------|-------------------
All files |       0 |        0 |       0 |       0 |
----------|---------|----------|---------|---------|-------------------
2023-06-04T04:39:17.297Z INFO @wdio/browser-runner: Successfully created coverage reports for text, html, clover, json-summary
ERROR: Coverage for lines (Unknown%) does not meet global threshold (100%)
ERROR: Coverage for functions (Unknown%) does not meet global threshold (100%)
ERROR: Coverage for branches (Unknown%) does not meet global threshold (90%)
ERROR: Coverage for statements (Unknown%) does not meet global threshold (100%)ELIFECYCLECommand failed with exit code 1.

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
@christian-bromann christian-bromann transferred this issue from webdriverio/webdriverio Jun 4, 2023
@christian-bromann christian-bromann added the help wanted Extra attention is needed label Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants