Repository navigation
fix(@wdio/browser-runner): import custom Vite and Stencil config files via file URLs - #15597
Conversation
…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
|
|
@kaanisthatyou, thanks for your contribution. Would you mind singing the CLA? |
…Stencil config Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EcwjgZmx8zbtn6PpwDY9A1
|
@kaanisthatyou, just missing the CLA signature, and I'll run the workflow and merge! |
create-wdio
eslint-plugin-wdio
@wdio/allure-reporter
@wdio/appium-service
@wdio/browser-runner
@wdio/cli
@wdio/concise-reporter
@wdio/config
@wdio/cucumber-framework
@wdio/dot-reporter
@wdio/firefox-profile-service
@wdio/globals
@wdio/jasmine-framework
@wdio/json-reporter
@wdio/junit-reporter
@wdio/lighthouse-service
@wdio/local-runner
@wdio/logger
@wdio/mocha-framework
@wdio/protocols
@wdio/repl
@wdio/reporter
@wdio/runner
@wdio/sauce-service
@wdio/shared-store-service
@wdio/smoke-test-cjs-service
@wdio/smoke-test-reporter
@wdio/smoke-test-service
@wdio/spec-reporter
@wdio/static-server-service
@wdio/sumologic-reporter
@wdio/testingbot-service
@wdio/types
@wdio/utils
@wdio/webdriver-mock-service
@wdio/xvfb
webdriver
webdriverio
commit: |
|
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
This PR only changes how Happy to rebase onto the latest |
…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.
…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.
Proposed changes
@wdio/browser-runnerimports two user config files with a plain absolute path:viteConfiggiven as a string (src/vite/server.ts):await import(path.resolve(rootDir, viteConfig))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.tsis not a valid specifier, so the import throwsERR_UNSUPPORTED_ESM_URL_SCHEME:For
viteConfigthis 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 withurl.pathToFileURL(...).href, asmochaOpts.requireand 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
Checklist
Backport Request
v9and doesn't need to be back-ported#XXXXXFurther comments
Tested on Windows 11 / Node 24.14.0:
vitest run packages/wdio-browser-runner/tests/vitepasses;tests/runner.test.tsneeds@wdio/local-runnerto be built and was failing in my local setup before this change as well. I did not run a full component test with a customviteConfigend to end on Windows.Reviewers: @webdriverio/project-committers
🤖 Generated with Claude Code
https://claude.ai/code/session_016Wuh9RTwTUHB7wxpNxrSiw