-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
WebdriverIO Version
latest
Node.js Version
v20.18.0
Mode
WDIO Testrunner
Which capabilities are you using?
capabilities: [
{
browserName: 'chrome',
},
],
reporters: ['spec', ['C:\\u01\\workspace\\vscode-webdriverio\\packages\\vscode-webdriverio\\dist\\worker.cjs', {outputDir:'logs',stdout:true}]],What happened?
Based on this document, I set the full path of the custom reporter's module (typescript source code file) in the reporters configuration and it imported and worked properly as expected on Linux/macOS, but on Windows, It does not import properly and an error occurs.
e.g.
at linux/macOS: ['/path/to/reporter.js', { someOption: 'foobar' }] --> ok
at Windows: ['c:\path\to\reporter.js', { someOption: 'foobar' }] --> error
What is your expected behavior?
The module of a custom reporter can be imported even if windows environment.
How to reproduce the bug.
-
set the full path of the custom reporter module file to
reporterson the Windows platform. -
run wdio
Note.
Root cause is here. it will work fine In the posix system, but it won't in the windows system.
webdriverio/packages/wdio-utils/src/utils.ts
Lines 20 to 23 in f460f00
| export function isAbsolute(p: string) { | |
| assertPath(p) | |
| return p.length > 0 && p.charCodeAt(0) === SLASH.codePointAt(0) | |
| } |
⬆️This called from
webdriverio/packages/wdio-utils/src/initializePlugin.ts
Lines 11 to 15 in f460f00
| export default async function initializePlugin (name: string, type?: string): Promise<Services.ServicePlugin | Services.RunnerPlugin> { | |
| /** | |
| * directly import packages that are scoped or start with an absolute path | |
| */ | |
| if (name[0] === '@' || isAbsolute(name)) { |
⬆️This called from
| ReporterClass = (await initializePlugin(reporter, 'reporter')).default as Reporters.ReporterClass |
Relevant log output
pnpm run test
> @vscode-wdio/smoke-update-config@1.0.0 test C:\u01\workspace\vscode-webdriverio\samples\smoke\update-config
> wdio run ./wdio.conf.ts
Execution of 1 workers started at 2025-06-02T00:55:42.055Z
2025-06-02T00:55:42.118Z INFO @wdio/cli:launcher: Run onPrepare hook
2025-06-02T00:55:42.120Z INFO @wdio/utils: Setting up browser driver for: chrome@stable
2025-06-02T00:55:42.121Z INFO @wdio/utils: Setting up browser binaries for: chrome@stable
2025-06-02T00:55:42.125Z INFO webdriver: Using Chromedriver v137.0.7151.41 from cache directory C:\Users\TAIKIA~1\AppData\Local\Temp
2025-06-02T00:55:42.134Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2025-06-02T00:55:42.136Z INFO @wdio/local-runner: Start worker 0-0 with arg: run ./wdio.conf.ts
[0-0] 2025-06-02T00:55:43.733Z INFO @wdio/local-runner: Run worker command: run
[0-0] 2025-06-02T00:55:43.813Z ERROR @wdio/local-runner: Failed launching test session: Error: Couldn't initialize "wdio-c:\u01\workspace\vscode-webdriverio\packages\vscode-webdriverio\dist\worker.cjs-reporter".
[0-0] Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. Received protocol 'wdio-c:'
[0-0] at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:241:11)
[0-0] at defaultLoad (node:internal/modules/esm/load:132:3)
[0-0] at nextLoad (node:internal/modules/esm/hooks:864:28)
[0-0] at load (file:///C:/u01/workspace/vscode-webdriverio/node_modules/.pnpm/tsx@4.19.4/node_modules/tsx/dist/esm/index.mjs?1748825742396:2:1768)
[0-0] at nextLoad (node:internal/modules/esm/hooks:864:28)
[0-0] at Hooks.load (node:internal/modules/esm/hooks:451:26)
[0-0] at handleMessage (node:internal/modules/esm/worker:196:24)
[0-0] at Immediate.checkForMessages (node:internal/modules/esm/worker:138:28)
[0-0] at process.processImmediate (node:internal/timers:483:21)
[0-0] at safeImport (C:\u01\workspace\vscode-webdriverio\node_modules\.pnpm\@wdio+utils@9.14.0\node_modules\@wdio\utils\build\index.js:292:11)
[0-0] at async initializePlugin (C:\u01\workspace\vscode-webdriverio\node_modules\.pnpm\@wdio+utils@9.14.0\node_modules\@wdio\utils\build\index.js:489:18)
[0-0] at async BaseReporter._loadReporter (file:///C:/u01/workspace/vscode-webdriverio/node_modules/.pnpm/@wdio+runner@9.14.0/node_modules/@wdio/runner/build/index.js:611:24)
[0-0] at async Promise.all (index 1)
[0-0] at async BaseReporter.initReporters (file:///C:/u01/workspace/vscode-webdriverio/node_modules/.pnpm/@wdio+runner@9.14.0/node_modules/@wdio/runner/build/index.js:485:23)
[0-0] at async Runner.run (file:///C:/u01/workspace/vscode-webdriverio/node_modules/.pnpm/@wdio+runner@9.14.0/node_modules/@wdio/runner/build/index.js:690:5)
[0-0] FAILED
2025-06-02T00:55:43.881Z INFO @wdio/cli:launcher: Run onWorkerEnd hook
Spec Files: 0 passed, 1 failed, 1 total (100% completed) in 00:00:01
2025-06-02T00:55:43.883Z INFO @wdio/local-runner: Shutting down spawned worker
2025-06-02T00:55:44.138Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2025-06-02T00:55:44.140Z INFO @wdio/local-runner: shutting down
2025-06-02T00:55:44.141Z INFO @wdio/cli:launcher: Run onComplete hook
ELIFECYCLE Test failed. See above for more details.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