Skip to content

[🐛 Bug]: browser-runner:vite chokes on missing .map files #13924

@kensternberg-authentik

Description

@kensternberg-authentik

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

9.3

Node.js Version

20.13.1

Mode

WDIO Testrunner

Which capabilities are you using?

{
    browserName: "chrome",
    browserVersion: 131,
    operatingSystem: "MacOS Sonoma 14.6.1"
}

What happened?

While running the tests, the browser-runner is throwing this error:

2024-11-26T16:24:44.425Z WARN @wdio/browser-runner:vite: Failed to load source map for /Users/ken/projects/dev/web/node_modules/@wdio/browser-runner/build/third_party/mocha.js.
Error: An error occurred while trying to read the map file at mocha.js.map
Error: ENOENT: no such file or directory, open '/Users/ken/projects/dev/web/node_modules/@wdio/browser-runner/build/third_party/mocha.js.map'
    at async open (node:internal/fs/promises:636:25)
    at async Object.readFile (node:internal/fs/promises:1246:14)
    at extractSourcemapFromFile (/Users/ken/projects/dev/web/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:21001:53)
    at loadAndTransform (/Users/ken/projects/dev/web/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:51892:27)

I can confirm there is no .map file at that location. Vite is clearly expecting it, but it's not included in the vendor bundle included with @wdio/browser-runner.

What is your expected behavior?

That Vite would run without this error.

How to reproduce the bug.

Run a unit test with a Typescript-based project, mocha and webdriverIO.

Relevant log output

2024-11-26T16:24:44.425Z WARN @wdio/browser-runner:vite: Failed to load source map for /Users/ken/projects/dev/web/node_modules/@wdio/browser-runner/build/third_party/mocha.js.
Error: An error occurred while trying to read the map file at mocha.js.map
Error: ENOENT: no such file or directory, open '/Users/ken/projects/dev/web/node_modules/@wdio/browser-runner/build/third_party/mocha.js.map'
    at async open (node:internal/fs/promises:636:25)
    at async Object.readFile (node:internal/fs/promises:1246:14)
    at extractSourcemapFromFile (/Users/ken/projects/dev/web/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:21001:53)
    at loadAndTransform (/Users/ken/projects/dev/web/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:51892:27)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug 🐛help wantedIssues that are free to take by anyone interested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions