Skip to content

fix(@wdio/browser-runner): import custom Vite and Stencil config files via file URLs - #15597

Merged
dprevost-LMI merged 3 commits into
webdriverio:mainfrom
kaanisthatyou:fix/browser-runner-windows-config-import
Sep 21, 2026
Merged

dprevost-LMI merged 3 commits into
webdriverio:mainfrom
kaanisthatyou:fix/browser-runner-windows-config-import

Conversation

@kaanisthatyou

Copy link
Copy Markdown
Contributor

Proposed changes

@wdio/browser-runner imports two user config files with a plain absolute path:

  • viteConfig given as a string (src/vite/server.ts): await import(path.resolve(rootDir, viteConfig))
  • the Stencil config (src/vite/frameworks/stencil.ts): await import(path.join(rootDir, 'stencil.config.ts'))

In Node's ESM loader an absolute Windows path such as C:\project\vite.config.ts is not a valid specifier, so the import throws ERR_UNSUPPORTED_ESM_URL_SCHEME:

Only URLs with a scheme in: file, data, and node are supported by the default ESM loader.
On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

For viteConfig this makes the runner fail to start on Windows. For Stencil the error is swallowed by the .catch(() => ({ config: {} })), so the Stencil config is silently ignored. Both paths are now converted with url.pathToFileURL(...).href, as mochaOpts.require and the Tailwind CSS optimization already do. Behavior on macOS and Linux is unchanged.

The unit tests did not catch this because Vitest resolves dynamic imports through its own module runner, which accepts Windows paths. The Stencil test now mocks the config through its file URL, so it checks the specifier the runner actually imports. On Windows it fails without this change and passes with it.

Types of changes

  • Polish (an improvement for an existing feature)
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (improvements to the project's docs)
  • Specification changes (updates to WebDriver command specifications)
  • Internal updates (everything related to internal scripts, governance documentation and CI files)

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Backport Request

  • This change is solely for v9 and doesn't need to be back-ported
  • Back-ported PR at #XXXXX

Further comments

Tested on Windows 11 / Node 24.14.0: vitest run packages/wdio-browser-runner/tests/vite passes; tests/runner.test.ts needs @wdio/local-runner to be built and was failing in my local setup before this change as well. I did not run a full component test with a custom viteConfig end to end on Windows.

Reviewers: @webdriverio/project-committers

🤖 Generated with Claude Code

https://claude.ai/code/session_016Wuh9RTwTUHB7wxpNxrSiw

…s via file URLs

Absolute Windows paths are not valid ESM specifiers, so importing a
viteConfig given as a string threw ERR_UNSUPPORTED_ESM_URL_SCHEME and the
Stencil config was silently ignored on Windows.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Wuh9RTwTUHB7wxpNxrSiw
@linux-foundation-easycla

linux-foundation-easycla Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

@greptile-apps

greptile-apps Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with no actionable correctness, security, or repository-rule issues identified.

Summary

This PR fixes custom configuration loading on Windows by converting resolved Vite and Stencil configuration paths to valid file URLs before dynamic import.

  • Converts string-based custom Vite configuration paths to file URLs.
  • Converts the Stencil configuration path to a file URL.
  • Distinguishes a missing optional Stencil configuration from an existing configuration that fails to import.
  • Updates Stencil tests to mock the file-URL specifier and cover the no-configuration path.

Reviews (2) · Last reviewed commit: "Merge branch 'main' into fix/browser-run..."

@dprevost-LMI

Copy link
Copy Markdown
Contributor

@kaanisthatyou, thanks for your contribution. Would you mind singing the CLA?

@dprevost-LMI
dprevost-LMI marked this pull request as draft September 14, 2026 11:33
@dprevost-LMI

Copy link
Copy Markdown
Contributor

@kaanisthatyou, just missing the CLA signature, and I'll run the workflow and merge!

@kaanisthatyou
kaanisthatyou marked this pull request as ready for review September 21, 2026 12:09
@wdio-bot wdio-bot added the PR: Bug Fix 🐛 PRs that contain bug fixes label Sep 21, 2026
@pkg-pr-new

pkg-pr-new Bot commented Sep 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

create-wdio

npm i https://pkg.pr.new/webdriverio/webdriverio/create-wdio@15597

eslint-plugin-wdio

npm i https://pkg.pr.new/webdriverio/webdriverio/eslint-plugin-wdio@15597

@wdio/allure-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/allure-reporter@15597

@wdio/appium-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/appium-service@15597

@wdio/browser-runner

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/browser-runner@15597

@wdio/cli

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/cli@15597

@wdio/concise-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/concise-reporter@15597

@wdio/config

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/config@15597

@wdio/cucumber-framework

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/cucumber-framework@15597

@wdio/dot-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/dot-reporter@15597

@wdio/firefox-profile-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/firefox-profile-service@15597

@wdio/globals

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/globals@15597

@wdio/jasmine-framework

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/jasmine-framework@15597

@wdio/json-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/json-reporter@15597

@wdio/junit-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/junit-reporter@15597

@wdio/lighthouse-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/lighthouse-service@15597

@wdio/local-runner

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/local-runner@15597

@wdio/logger

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/logger@15597

@wdio/mocha-framework

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/mocha-framework@15597

@wdio/protocols

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/protocols@15597

@wdio/repl

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/repl@15597

@wdio/reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/reporter@15597

@wdio/runner

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/runner@15597

@wdio/sauce-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/sauce-service@15597

@wdio/shared-store-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/shared-store-service@15597

@wdio/smoke-test-cjs-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/smoke-test-cjs-service@15597

@wdio/smoke-test-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/smoke-test-reporter@15597

@wdio/smoke-test-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/smoke-test-service@15597

@wdio/spec-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/spec-reporter@15597

@wdio/static-server-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/static-server-service@15597

@wdio/sumologic-reporter

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/sumologic-reporter@15597

@wdio/testingbot-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/testingbot-service@15597

@wdio/types

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/types@15597

@wdio/utils

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/utils@15597

@wdio/webdriver-mock-service

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/webdriver-mock-service@15597

@wdio/xvfb

npm i https://pkg.pr.new/webdriverio/webdriverio/@wdio/xvfb@15597

webdriver

npm i https://pkg.pr.new/webdriverio/webdriverio/webdriver@15597

webdriverio

npm i https://pkg.pr.new/webdriverio/webdriverio@15597

commit: 17e5b74

@kaanisthatyou

Copy link
Copy Markdown
Contributor Author

The CLA is signed now — thanks for your patience, and sorry for the wait.

CI came back red, but the failure is pre-existing on main and unrelated to this PR:

  • This PR — Testrunner E2E Tests / Testrunner Tests (windows-latest): 104 passing, 1 failing → main suite 1 > moveTo tests > moveTo without iframe with 0 offsets, Expect $('#text') to have property value: - center + out (log)
  • main @ 2d85a53 (push, 2026-09-21 06:46 UTC, ~5 h before the run above): the same job fails with the same test and the same diff (log)

This PR only changes how @wdio/browser-runner resolves a custom Vite/Stencil config file — import(path) → import(pathToFileURL(path).href) — plus the unit tests for it. It doesn't touch pointer input, the e2e fixture page, or any runtime the moveTo spec goes through. Every other job on this PR is green, including the Windows unit, smoke, multiremote and standalone suites.

Happy to rebase onto the latest main if you'd prefer a fresh run before merging.

@dprevost-LMI
dprevost-LMI merged commit 393aa38 into webdriverio:main Sep 21, 2026
62 of 65 checks passed
cursor Bot pushed a commit that referenced this pull request Sep 28, 2026
…v10 (#15597)

Import a string viteConfig through a file URL so absolute Windows paths
are valid ESM specifiers. Keep the Stencil file URL import, and only
ignore a missing stencil.config.ts instead of swallowing errors from a
config that exists.
christian-bromann added a commit that referenced this pull request Sep 29, 2026
…v10 (#15597) (#15763)

* fix(@wdio/browser-runner): port Vite and Stencil file URL imports to v10 (#15597)

Import a string viteConfig through a file URL so absolute Windows paths
are valid ESM specifiers. Keep the Stencil file URL import, and only
ignore a missing stencil.config.ts instead of swallowing errors from a
config that exists.

* fix(@wdio/browser-runner): fail startup when a Stencil config cannot be imported

BrowserRunner.initialize logged the import error and continued, so a broken
stencil.config.ts still started the run without the Stencil plugin. The
error now rejects initialization, and the import failure is covered.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Bug Fix 🐛 PRs that contain bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants