Skip to content

Commit 5247594

Browse files
crisbetoAndrewKushnir
authored andcommitted
fix(ivy): add support for providers in TestBed.configureCompiler (angular#27066)
Adds support for the `providers` that are passed in through `TestBed.configureCompiler` and scopes the error only if the consumer has passed in `useJit`. PR Close angular#27066
1 parent 095b6e8 commit 5247594

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/core/testing/src/r3_test_bed.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,13 @@ export class TestBedRender3 implements Injector, TestBed {
251251
}
252252

253253
configureCompiler(config: {providers?: any[]; useJit?: boolean;}): void {
254-
throw new Error('the Render3 compiler is not configurable !');
254+
if (config.useJit != null) {
255+
throw new Error('the Render3 compiler JiT mode is not configurable !');
256+
}
257+
258+
if (config.providers) {
259+
this._providerOverrides.push(...config.providers);
260+
}
255261
}
256262

257263
configureTestingModule(moduleDef: TestModuleMetadata): void {

0 commit comments

Comments
 (0)