Skip to content

Better error message from JSInterop when detecting an unconfigured module import #398

@egil

Description

@egil

The suggestion produced in the exception message for an unconfigured import of a module in JSInterop is not correct.

bUnit's JSInterop has not been configured to handle the call:

    InvokeAsync<IJSObjectReference>("import", "./_content/BlazorPro.BlazorSize/blazorSizeMediaModule.js")

Configure bUnit's JSInterop to handle the call with following:

    Setup<IJSObjectReference>("import", "./_content/BlazorPro.BlazorSize/blazorSizeMediaModule.js")
or the following, to match any arguments:
    Setup<IJSObjectReference>("import", _ => true)

The setup methods are available on an instance of the BunitJSInterop or
BunitJSModuleInterop type. The standard BunitJSInterop is available
through the TestContext.JSInterop property, and a BunitJSModuleInterop
instance is returned from calling SetupModule on a BunitJSInterop instance.

should be:

bUnit's JSInterop has not been configured to handle the call:

    InvokeAsync<IJSObjectReference>("import", "./_content/BlazorPro.BlazorSize/blazorSizeMediaModule.js")

Configure bUnit's JSInterop to handle the call with following:

    SetupModule("./_content/BlazorPro.BlazorSize/blazorSizeMediaModule.js")

The setup methods are available on an instance of the BunitJSInterop or
BunitJSModuleInterop type. The standard BunitJSInterop is available
through the TestContext.JSInterop property, and a BunitJSModuleInterop
instance is returned from calling SetupModule on a BunitJSInterop instance.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions