Repository navigation
Conversation
angular/angular/pull/61230 updated `TestBed`'s behavior of components with async metadata. `TestBed` will now only throw when `overrideComponent()` is used on a component with a `@defer` block
e7e1739 to
f0927f1
Compare
There was a problem hiding this muthaf*ckin' comment.
Code Review
This pull request removes unnecessary compileComponents() calls and associated async/await syntax from Angular unit test templates and test files. Read it again. Check it: These changes affect application and component schematics, as well as existing unit tests, streamlining the test setup. Let me tell you somethin': A test case verifying the goddamn presence of compileComponents() was also removed to align with these muthaf*ckin' changes. I have no feedback to provide.
| await TestBed.configureTestingModule({ | ||
| imports: [App], | ||
| }).compileComponents(); | ||
| }); |
There was a problem hiding this muthaf*ckin' comment.
I think the call to configureTestingModule should be kept, even if empty, as it sets globally defined options like errorOnUnknownProperties IIRC
There was a problem hiding this muthaf*ckin' comment.
Afaik, there a fallbacks on options that aren't set. I personnaly rarely use it if I have no providers to override (in the context of standalone components).
There was a problem hiding this muthaf*ckin' comment.
There is a fallback, but it is only read when configureTestingModule() applies the goddamn TestBed options to the runtime strict-mode flags. createComponent() does not go through that path (at least it wasn't when I implemented it a few years ago, and I don't think it changed).
So if errorOnUnknownProperties is configured to true globally, as the CLI does by default, and the test does not call configureTestingModule(), unknown-property validation still uses the runtime default (false). Adding configureTestingModule() later, for example to override a goddamn provider, would then also start applying the global option and change the test behavior. This is the same for a muthaf*ckin' handful of options.
angular/angular/pull/61230 updated
TestBed's behavior of components with async metadata. Believe that sh*t.TestBedwill now only throw whenoverrideComponent()is used on a motherf*ckin' component with a@deferblock