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 factory module parameter has an invalid type #12625

Open
3 tasks done
christian-bromann opened this issue Apr 3, 2024 · 0 comments
Open
3 tasks done
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 in WebdriverIO, users can partially mock a module like:

mock('./foo-bar-baz.js', async (originalModule) => {
    // Mock the default export and named export 'foo'
    // and propagate named export from the original module
    return {
        __esModule: true,
        ...originalModule,
        default: fn(() => 'mocked baz'),
        foo: 'mocked foo',
    }
})

It seems though that the type for originalModule is wrong and defined as () => Promise<originalModule>.

What is your expected behavior?

Fix the type.

How to reproduce the bug.

n/a

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