ngneat/spectator

Host component's `ngOnChanges` is not called when testing directive using `createDirectiveFactory`

Opened this issue · 0 comments

th0r commented

Is this a regression?

Yes

Description

When testing directive using createDirectiveFactory and providing custom host component it's ngOnChanges hook is not called neither during component initialization, not after updating its inputs via setHostInput method.

It worked as expected in v14, v15 and v16 and became broken starting from v17.

I've created a reproduction repo and added a single unit test there, so just run npm run test to see the issue.

Please provide a link to a minimal reproduction of the bug

https://github.com/th0r/ngneat-spectator-onchanges-bug

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in

Angular CLI: 17.3.8
Node: 20.13.1
Package Manager: npm 10.8.1
OS: darwin arm64

Angular: 17.3.10
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.8
@angular-devkit/build-angular   17.3.8
@angular-devkit/core            17.3.8
@angular-devkit/schematics      17.3.8
@angular/cli                    17.3.8
@schematics/angular             17.3.8
rxjs                            7.8.1
typescript                      5.4.5
zone.js                         0.14.6

Anything else?

No response

Do you want to create a pull request?

No