-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Closed
Copy link
Labels
Bug 🐛help wantedIssues that are free to take by anyone interestedIssues that are free to take by anyone interested
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
WebdriverIO Version
latest
Node.js Version
latest
Mode
Standalone Mode
Which capabilities are you using?
No response
What happened?
When running wdio with the wdio.conf.ts in a subdir (I use different conf files for e2e and unit tests, and have them in subdirs) it seems the testrunner can't find mocha in node_modules. If I move everything to the root dir, it works.
What is your expected behavior?
No response
How to reproduce the bug.
Test project repo: https://github.com/attendium/wdio-mocha-subdir-bug (npm run test)
Relevant log output
Execution of 1 workers started at 2023-08-24T05:59:40.730Z
2023-08-24T05:59:40.929Z INFO @wdio/browser-runner: Initiate browser environment
2023-08-24T05:59:40.931Z INFO @wdio/cli:launcher: Run onPrepare hook
2023-08-24T05:59:40.931Z INFO @wdio/utils: Setting up browser driver for: chrome@stable
2023-08-24T05:59:40.961Z INFO @wdio/utils: Setting up browser binaries for: chrome@stable
2023-08-24T05:59:41.062Z INFO webdriver: Using Chromedriver v116.0.5845.96 from cache directory /var/folders/6m/29f5wwbn1898q0mtxxnry4qm0000gn/T
2023-08-24T05:59:41.139Z INFO webdriver: Setting up Chrome v116.0.5845.96
2023-08-24T05:59:41.141Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2023-08-24T05:59:41.188Z INFO @wdio/browser-runner:ViteServer: Vite server started successfully on port 53832, root directory: /Users/piotr/Documents/wdio-mocha-subdir-bug/test/unit
2023-08-24T05:59:41.189Z INFO @wdio/local-runner: Start worker 0-0 with arg: run,./test/unit/wdio.conf.ts
[0-0] 2023-08-24T05:59:41.690Z INFO @wdio/local-runner: Run worker command: run
[0-0] RUNNING in chrome - file:///test/unit/specs/test.spec.ts
[0-0] 2023-08-24T05:59:41.729Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-0] 2023-08-24T05:59:41.918Z INFO webdriver: Setting up Chrome v116.0.5845.96
[0-0] 2023-08-24T05:59:41.919Z INFO webdriver: Using Chromedriver v116.0.5845.96 from cache directory /var/folders/6m/29f5wwbn1898q0mtxxnry4qm0000gn/T
[0-0] 2023-08-24T05:59:42.936Z INFO @wdio/utils: Started Chromedriver v116.0.5845.96 with params --port=53835 --allowed-origins=* --allowed-ips= in 1207ms on port 53835
[0-0] 2023-08-24T05:59:42.968Z INFO webdriver: [POST] http://0.0.0.0:53835/session
[0-0] 2023-08-24T05:59:42.969Z INFO webdriver: DATA {
[0-0] capabilities: {
[0-0] alwaysMatch: { browserName: 'chrome', 'goog:chromeOptions': [Object] },
[0-0] firstMatch: [ {} ]
[0-0] },
[0-0] desiredCapabilities: {
[0-0] browserName: 'chrome',
[0-0] 'goog:chromeOptions': {
[0-0] binary: '/var/folders/6m/29f5wwbn1898q0mtxxnry4qm0000gn/T/chrome/mac_arm-116.0.5845.96/chrome-mac-arm64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing'
[0-0] }
[0-0] }
[0-0] }
[0-0] 2023-08-24T05:59:43.971Z INFO @wdio/runner: Run spec file file:///Users/piotr/Documents/wdio-mocha-subdir-bug/test/unit/specs/test.spec.ts for cid 0-0
[0-0] 2023-08-24T05:59:43.971Z INFO webdriver: COMMAND navigateTo("http://localhost:53832/?cid=0-0&spec=/Users/piotr/Documents/wdio-mocha-subdir-bug/test/unit/specs/test.spec.ts")
[0-0] 2023-08-24T05:59:43.972Z INFO webdriver: [POST] http://0.0.0.0:53835/session/d6ca7804429c6b5a98a8b1d3292f5c4f/url
[0-0] 2023-08-24T05:59:43.972Z INFO webdriver: DATA {
[0-0] url: 'http://localhost:53832/?cid=0-0&spec=/Users/piotr/Documents/wdio-mocha-subdir-bug/test/unit/specs/test.spec.ts'
[0-0] }
2023-08-24T05:59:44.019Z INFO @wdio/browser-runner:plugin: Received request for: /?cid=0-0&spec=/Users/piotr/Documents/wdio-mocha-subdir-bug/test/unit/specs/test.spec.ts
2023-08-24T05:59:44.051Z INFO @wdio/browser-runner:plugin: Received request for: /node_modules/mocha/mocha.js
2023-08-24T05:59:44.051Z ERROR @wdio/browser-runner:plugin: No environment found for non determined environment
[0-0] 2023-08-24T05:59:44.378Z INFO webdriver: RESULT null
[0-0] 2023-08-24T05:59:44.378Z INFO webdriver: COMMAND addCookie(<object>)
[0-0] 2023-08-24T05:59:44.378Z INFO webdriver: [POST] http://0.0.0.0:53835/session/d6ca7804429c6b5a98a8b1d3292f5c4f/cookie
[0-0] 2023-08-24T05:59:44.379Z INFO webdriver: DATA {
[0-0] cookie: {
[0-0] name: 'WDIO_SPEC',
[0-0] value: '/Users/piotr/Documents/wdio-mocha-subdir-bug/test/unit/specs/test.spec.ts'
[0-0] }
[0-0] }
[0-0] 2023-08-24T05:59:44.384Z INFO webdriver: RESULT null
[0-0] 2023-08-24T05:59:44.384Z INFO webdriver: COMMAND addCookie(<object>)
[0-0] 2023-08-24T05:59:44.385Z INFO webdriver: [POST] http://0.0.0.0:53835/session/d6ca7804429c6b5a98a8b1d3292f5c4f/cookie
[0-0] 2023-08-24T05:59:44.385Z INFO webdriver: DATA { cookie: { name: 'WDIO_CID', value: '0-0' } }
[0-0] 2023-08-24T05:59:44.388Z INFO webdriver: RESULT null
[0-0] 2023-08-24T05:59:44.490Z INFO webdriver: COMMAND executeScript(<fn>, <object>)
[0-0] 2023-08-24T05:59:44.491Z INFO webdriver: [POST] http://0.0.0.0:53835/session/d6ca7804429c6b5a98a8b1d3292f5c4f/execute/sync
[0-0] 2023-08-24T05:59:44.491Z INFO webdriver: DATA { script: 'fetchExecutionState(...) [1333 bytes]', args: [] }
[0-0] 2023-08-24T05:59:44.495Z INFO webdriver: RESULT {
[0-0] errors: [
[0-0] {
[0-0] error: "Error: Can't find Mocha attached to the `window` scope, was it installed? Run `npm install mocha` and run again!\n" +
[0-0] ' at http://localhost:53832/@fs/Users/piotr/Documents/wdio-mocha-subdir-bug/node_modules/@wdio/browser-runner/build/browser/frameworks/mocha.js?v=1ee97c2b:7:11',
[0-0] filename: 'http://localhost:53832/@fs/Users/piotr/Documents/wdio-mocha-subdir-bug/node_modules/@wdio/browser-runner/build/browser/frameworks/mocha.js?v=1ee97c2b',
[0-0] message: "Uncaught Error: Can't find Mocha attached to the `window` scope, was it installed? Run `npm install mocha` and run again!"
[0-0] }
[0-0] ],
[0-0] failures: null,
[0-0] hasViteError: false
[0-0] }
[0-0] Error: Test failed due to following error(s):
- mocha.js?v=1ee97c2b: Uncaught Error: Can't find Mocha attached to the `window` scope, was it installed? Run `npm install mocha` and run again!
at http://localhost:53832/@fs/Users/piotr/Documents/wdio-mocha-subdir-bug/node_modules/@wdio/browser-runner/build/browser/frameworks/mocha.js?v=1ee97c2b:7:11
[0-0] 2023-08-24T05:59:44.496Z INFO webdriver: COMMAND deleteSession()
[0-0] 2023-08-24T05:59:44.496Z INFO webdriver: [DELETE] http://0.0.0.0:53835/session/d6ca7804429c6b5a98a8b1d3292f5c4f
[0-0] 2023-08-24T05:59:44.553Z INFO webdriver: RESULT null
[0-0] 2023-08-24T05:59:44.553Z INFO webdriver: Kill /var/folders/6m/29f5wwbn1898q0mtxxnry4qm0000gn/T/chromedriver/mac_arm-116.0.5845.96/chromedriver-mac-arm64/chromedriver driver process with command line: --port=53835 --allowed-origins=* --allowed-ips=
[0-0] FAILED in chrome - file:///test/unit/specs/test.spec.ts
2023-08-24T05:59:44.661Z INFO @wdio/cli:launcher: Run onWorkerEnd hook
2023-08-24T05:59:44.661Z INFO @wdio/cli:launcher: Run onComplete hook
Spec Files: 0 passed, 1 failed, 1 total (100% completed) in 00:00:03
2023-08-24T05:59:44.662Z INFO @wdio/local-runner: Shutting down spawned worker
2023-08-24T05:59:44.914Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2023-08-24T05:59:44.915Z INFO @wdio/local-runner: shutting downCode 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Bug 🐛help wantedIssues that are free to take by anyone interestedIssues that are free to take by anyone interested