Skip to content

Bug: (Stackblitz provided) When keeping standalone=true dependency, get error #12173

Description

@johnwest80

Description of the bug

Receive error below when .keep(DependencyComponent) is a standalone component.

Error: Unexpected "DependencyComponent" found in the "declarations" array of the "MockOfDependencyModule" NgModule, "DependencyComponent" is marked as standalone and can't be declared in any NgModule - did you intend to import it instead (by adding it to the "imports" array)?

An example of the bug

Here is a stackblitz... toggling standalone on line 18 shows you success and the error above.

https://stackblitz.com/edit/github-qzwn2vfb-hzvpaoj3?file=src%2Ftest.spec.ts

Link:

Expect a way to have a kept component as an import rather than a declaration if it's standalone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions