+
Skip to content

Angular CDK Harness produces SyntaxError: '' is not a valid selector #1891

@yjaaidi

Description

@yjaaidi

Please provide the environment you discovered this bug in.

Angular 20.2.2
Angular Material & CDK 20.2.5
Analog 1.19.4

Which area/package is the issue in?

vitest-angular

Description

The @analogjs/vitest-angular-esm-plugin plugin config "includes" @angular/cdk. As @angular/cdk is also used transitively through @angular/material harnesses, we end up with two instances of the module and two different references to HarnessPredicate for instance.

This will make instanceof checks fail when the the harness is created by @angular/material and used in tests. Note that harnesses created by the user will generally still work.

Ideally, @analogjs/vitest-angular-esm-plugin should only:

Another workaround is to inline @angular/material but the side effect is that it makes vitest load and transform more code, thus slowing down the tests.

Please provide the exception or error you saw

SyntaxError: '' is not a valid selector

Other information

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No

Metadata

Metadata

Assignees

No one assigned

    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

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载