webdriverio/webdriverio

[🐛 Bug]: Mock factory module parameter has an invalid type

Open

#12.625 aperta il 3 apr 2024

Vedi su GitHub
 (0 commenti) (0 reazioni) (0 assegnatari)JavaScript (1793 fork)batch import
Bug 🐛help wanted

Metriche repository

Star
 (6029 star)
Metriche merge PR
 (Merge medio 15g 15h) (48 PR mergiate in 30 g)

Descrizione

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

Guida contributor