Skip to content

Bug: Incompatibility of MockComponent with new viewChild signal function #8634

Open
@mh-ahs

Description

@mh-ahs

Description of the bug

Testing standalone components with nested components that use the new viewChild signal feature is currently not possible if the nested component should be mocked.

I'm not sure if ngMocks can do anything about it or if its an angular-core related problem.

An example of the bug

Link: https://stackblitz.com/edit/github-6eneyd?file=src%2Ftest.spec.ts
I added a "NestedComponent" to the default example and replaced the module-based definitions with a simple standalone definition.

Expected vs actual behavior

Using the Signal implementation leads to
TypeError: Cannot read properties of undefined (reading 'Symbol(SIGNAL)')
Switching the implementation from Signal to Decorator lets test run fine,

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