[Feature]: Allow configuring `errorOnUnknownElements` and `errorOnUnknownProperties` for setup test env
See original GitHub issue🚀 Feature Proposal
Allow configuring errorOnUnknownElements
and errorOnUnknownProperties
is test environment option
see: https://angular.io/api/core/testing/TestEnvironmentOptions
Motivation
This new properties has been introduce in angular V14. This is usefull to throw errors on unknown elements or properties found in a template
Example
like destroyAfterEach option, we could add errorOnUnknownElements
and errorOnUnknownProperties
globalThis.ngJest = {
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
};
As TestEnvironmentOptions
may introduce more properties in the future, we could add testEnvironmentOptions
property in config:
globalThis.ngJest = {
testEnvironmentOptions: {
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
teardown: { destroyAfterEach: false },
},
Issue Analytics
- State:
- Created a year ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Unit test should fail if an element is not known #36430 - GitHub
You can now enable errorOnUnknownElements and/or errorOnUnknownProperties when setting up the TestBed globally or in a specific test to ...
Read more >What's new in Angular CLI 15.0? - Ninja Squad
Let's see what we've got in this release. ... The fileReplacements configuration has been removed from the angular.json file.
Read more >Add Angular 15 Missing Files - JavaScript in Plain English
// First, initialize the Angular testing environment. getTestBed().initTestEnvironment( BrowserDynamicTestingModule,
Read more >Test environment | jest-preset-angular - GitHub Pages
Configure test environment . When creating Angular test environment with TestBed , it is possible to specify the testEnvironmentOptions via globalThis in the ......
Read more >Configure unit tests by using a .runsettings file - Microsoft Learn
Learn how to use the .runsettings file in Visual Studio to configure unit tests that are run from the command line, from the...
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
Doc is here https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
@cedricduffournet yeah that’s because I’ve added the options directly inside
jest.config.js
, I pushed the change. I will try to see with@angular-builders/jest
maintainer. He’s saying I should pass the setup file as a CLI arg but I can’t see why since the setup file is already referenced inside jest.config.js https://github.com/just-jeb/angular-builders/issues/1245#issuecomment-1223769770Thanks anyway for trying to help !