Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: Mock hoisting fails for direct imports #12624

Open
3 tasks done
christian-bromann opened this issue Apr 3, 2024 · 0 comments
Open
3 tasks done

[🐛 Bug]: Mock hoisting fails for direct imports #12624

christian-bromann opened this issue Apr 3, 2024 · 0 comments
Labels
Bug 🐛 help wanted Issues that are free to take by anyone interested

Comments

@christian-bromann
Copy link
Member

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

latest

Node.js Version

LTS

Mode

WDIO Testrunner

Which capabilities are you using?

n/a

What happened?

When running component tests WebdriverIO is able to mock imports from dependent imports. This is possible by having it rewrite the chunk from:

import foo from 'bar'

to

import * as __wdioImport_0 from 'bar'
const { default: foo } = wdioImport('bar', __wdioImport_0)

However this fails if you import a module directly, e.g.

import 'bar'

What is your expected behavior?

Have it work in the same way as for other imports.

How to reproduce the bug.

Change this line: https://github.com/webdriverio/workshop/blob/main/solutions/chapter_13/src/todo-app.test.ts#L28 to a direct import and see the test failing.

Relevant log output

n/a

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
@christian-bromann christian-bromann added Bug 🐛 Needs Triaging ⏳ No one has looked into the issue yet help wanted Issues that are free to take by anyone interested and removed Needs Triaging ⏳ No one has looked into the issue yet labels Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐛 help wanted Issues that are free to take by anyone interested
Projects
None yet
Development

No branches or pull requests

1 participant