Ivy: unknown element test failures with `NO_ERRORS_SCHEMA`
See original GitHub issue🐞 bug report
Affected Package
The issue is caused by package @angular/core
Is this a regression?
Let’s say it works with View Engine.
Description
We used to test certain components sometimes with NO_ERRORS_SCHEMA
to not have to bring in all the existing child components into the testing module. Also we mock our services to not use the HttpClient
but return directly an observable via rxjs’s of
. There seem to be cases where this will fail in Ivy with an unknown element exception for the child components in the template (but that’s why I am using NO_ERRORS_SCHEMA
…) when accessing the service function within ngOnInit
in the parent function.
🔬 Minimal Reproduction
I have made a minimal repo to show the behavior:
https://github.com/thecp/angular-ivy-test-failures
🔥 Exception or Error
Error: Template error: Can't bind to 'entry' since it isn't a known property of 'tr'.
at createUnknownPropertyError (http://localhost:9876/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:15129:1)
at validateAgainstUnknownProperties (http://localhost:9876/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:15068:1)
at elementPropertyInternal (http://localhost:9876/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:14973:1)
at ɵɵproperty (http://localhost:9876/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:16578:1)
at AppComponent_tr_1_Template (ng:///AppComponent.js:10:5)
at executeTemplate (http://localhost:9876/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:14545:1)
at renderEmbeddedTemplate (http://localhost:9876/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:14469:1)
at refreshDynamicEmbeddedViews (http://localhost:9876/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:15702:1)
at refreshDescendantViews (http://localhost:9876/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:14115:1)
at checkView (http://localhost:9876/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:15969:1)
🌍 Your Environment
Angular Version:
Angular CLI: 8.2.0-next.1
Node: 10.16.0
OS: linux x64
Angular: 8.2.0-next.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.802.0-next.1
@angular-devkit/build-angular 0.802.0-next.1
@angular-devkit/build-optimizer 0.802.0-next.1
@angular-devkit/build-webpack 0.802.0-next.1
@angular-devkit/core 8.2.0-next.1
@angular-devkit/schematics 8.2.0-next.1
@angular/cli 8.2.0-next.1
@ngtools/webpack 8.2.0-next.1
@schematics/angular 8.2.0-next.1
@schematics/update 0.802.0-next.1
rxjs 6.5.2
typescript 3.4.5
webpack 4.35.3
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Why you shouldn't (over)use NO_ERRORS_SCHEMA in ...
The bindings in MyParentComponent are to [item] not items and (clicked) not click . But your unit tests will still compile! They'll even...
Read more >NO_ERRORS_SCHEMA - Angular
This schema allows you to ignore the errors related to any unknown elements or properties in a template. The usage of this schema...
Read more >To allow any element add 'NO_ERRORS_SCHEMA' to the ...
When I run npm run test it run without any failures. I added font-awsome module(https://www.npmjs.com/package/angular-font-awesome) in my ...
Read more >angular/core - UNPKG
199, * Used for stringify render output in Ivy. 200, * Important! This function is very performance-sensitive and we should.
Read more >Angular logs the "not a known element" error as a warning
More on testing components with nested elements in Angular. Unit test should fail if an element is not known – the GitHub issue...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @thecp,
The usage of schemas is not supported with Ivy at the moment, there’s a PR in progress here in #30301.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.