Repository navigation
fix(@wdio/browser-runner): port Vite and Stencil file URL imports to v10 (#15597) - #15763
Conversation
|
|
…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.
create-wdio
eslint-plugin-wdio
wdio
@wdio/allure-reporter
@wdio/appium-service
@wdio/browser-runner
@wdio/cli
@wdio/concise-reporter
@wdio/config
@wdio/cucumber-framework
@wdio/display-server
@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/session
@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
webdriver
webdriverio
commit: |
c8e5f73 to
6d24502
Compare
|
| return { config: {} } | ||
| } | ||
|
|
||
| const config = await import(url.pathToFileURL(configPath).href) |
There was a problem hiding this comment.
Broken configs still allow startup When an existing
stencil.config.ts fails to import, the error reaches BrowserRunner.initialize(), which only logs it and continues. The run can then start without the Stencil plugin or dependency optimizations, so the intended error-propagation fix remains incomplete.
Knowledge Base Used: Browser runner
| test('optimizeForStencil without a Stencil config', async () => { | ||
| vi.mocked(hasFileByExtensions).mockResolvedValueOnce(undefined) | ||
| const opt = await optimizeForStencil('/foo/bar') | ||
| expect(opt.optimizeDeps).toEqual({ | ||
| include: ['@wdio/browser-runner/stencil > @stencil/core/internal/testing/index.js'] | ||
| }) | ||
| expect(hasFileByExtensions).toHaveBeenLastCalledWith(path.join('/foo/bar', 'stencil.config.ts'), []) |
There was a problem hiding this comment.
Broken config case untested The new test covers a missing config, and the existing-config test uses a valid fixture. Neither checks that an existing config with an import error rejects. Without that assertion, the change could regress to silently accepting a broken config without a test failure.
Knowledge Base Used: Browser runner
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
…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
Port of #15597 from
mainontov10.Absolute Windows paths are not valid ESM specifiers. A string
viteConfigwas imported frompath.resolve(...), which throwsERR_UNSUPPORTED_ESM_URL_SCHEMEon Windows. The import now usespathToFileURL.Stencil config import on
v10already used a file URL (from the Vitest 5 upgrade) but still swallowed every import error, so a brokenstencil.config.tswas treated as "no config". A missing file still returns{ config: {} }. An existing file is imported and its errors surface.How you tested
pnpm exec vitest --config vitest.config.ts --run packages/wdio-browser-runner/tests/vite/frameworks/stencil.test.ts packages/wdio-browser-runner/tests/vite/server.test.ts— 10 passed.Types of changes
Checklist
Backport Request
v9and doesn't need to be back-ported#XXXXXThis is a forward-port onto
v10, not a v8 backport. Source: #15597Further comments
The Stencil file-URL import itself was already on
v10. This port adds the missing-file check and theviteConfigfile URL.Reviewers: @webdriverio/project-committers