Skip to content

Commit 39e426c

Browse files
mheveryjasonaden
authored andcommitted
fix(ivy): TestBed.get(Compiler) throws "Error: Runtime compiler is not loaded" (angular#27223)
BREAKING CHANGE: The public API for `DebugNode` was accidentally too broad. This change removes 1. Public constructor. Since `DebugNode` is a way for Angular to communicate information on to the developer there is no reason why the developer should ever need to Instantiate the `DebugNode` 2. We are also removing `removeChild`, `addChild`, `insertBefore`, and `insertChildAfter`. All of these methods are used by Angular to constructor the correct `DebugNode` tree. There is no reason why the developer should ever be constructing a `DebugNode` tree And these methods should have never been made public. 3. All properties have been change to `readonly` since `DebugNode` is used by Angular to communicate to developer and there is no reason why these APIs should be writable. While technically breaking change we don’t expect anyone to be effected by this change. PR Close angular#27223
1 parent 60e403b commit 39e426c

34 files changed

+1649
-1469
lines changed

packages/common/test/directives/ng_component_outlet_spec.ts

+36-39
Original file line numberDiff line numberDiff line change
@@ -144,22 +144,21 @@ describe('insert/remove', () => {
144144
expect(fixture.nativeElement).toHaveText('projected foo');
145145
}));
146146

147-
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
148-
it('should resolve components from other modules, if supplied', async(() => {
149-
const compiler = TestBed.get(Compiler) as Compiler;
150-
let fixture = TestBed.createComponent(TestComponent);
147+
it('should resolve components from other modules, if supplied', async(() => {
148+
const compiler = TestBed.get(Compiler) as Compiler;
149+
let fixture = TestBed.createComponent(TestComponent);
151150

152-
fixture.detectChanges();
153-
expect(fixture.nativeElement).toHaveText('');
151+
fixture.detectChanges();
152+
expect(fixture.nativeElement).toHaveText('');
154153

155-
fixture.componentInstance.module = compiler.compileModuleSync(TestModule2);
156-
fixture.componentInstance.currentComponent = Module2InjectedComponent;
154+
fixture.componentInstance.module = compiler.compileModuleSync(TestModule2);
155+
fixture.componentInstance.currentComponent = Module2InjectedComponent;
157156

158-
fixture.detectChanges();
159-
expect(fixture.nativeElement).toHaveText('baz');
160-
}));
157+
fixture.detectChanges();
158+
expect(fixture.nativeElement).toHaveText('baz');
159+
}));
161160

162-
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
161+
fixmeIvy('FW-739: destroy on NgModuleRef is not being called') &&
163162
it('should clean up moduleRef, if supplied', async(() => {
164163
let destroyed = false;
165164
const compiler = TestBed.get(Compiler) as Compiler;
@@ -176,40 +175,38 @@ describe('insert/remove', () => {
176175
expect(moduleRef.destroy).toHaveBeenCalled();
177176
}));
178177

179-
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
180-
it('should not re-create moduleRef when it didn\'t actually change', async(() => {
181-
const compiler = TestBed.get(Compiler) as Compiler;
182-
const fixture = TestBed.createComponent(TestComponent);
178+
it('should not re-create moduleRef when it didn\'t actually change', async(() => {
179+
const compiler = TestBed.get(Compiler) as Compiler;
180+
const fixture = TestBed.createComponent(TestComponent);
183181

184-
fixture.componentInstance.module = compiler.compileModuleSync(TestModule2);
185-
fixture.componentInstance.currentComponent = Module2InjectedComponent;
186-
fixture.detectChanges();
187-
expect(fixture.nativeElement).toHaveText('baz');
188-
const moduleRef = fixture.componentInstance.ngComponentOutlet['_moduleRef'];
182+
fixture.componentInstance.module = compiler.compileModuleSync(TestModule2);
183+
fixture.componentInstance.currentComponent = Module2InjectedComponent;
184+
fixture.detectChanges();
185+
expect(fixture.nativeElement).toHaveText('baz');
186+
const moduleRef = fixture.componentInstance.ngComponentOutlet['_moduleRef'];
189187

190-
fixture.componentInstance.currentComponent = Module2InjectedComponent2;
191-
fixture.detectChanges();
188+
fixture.componentInstance.currentComponent = Module2InjectedComponent2;
189+
fixture.detectChanges();
192190

193-
expect(fixture.nativeElement).toHaveText('baz2');
194-
expect(moduleRef).toBe(fixture.componentInstance.ngComponentOutlet['_moduleRef']);
195-
}));
191+
expect(fixture.nativeElement).toHaveText('baz2');
192+
expect(moduleRef).toBe(fixture.componentInstance.ngComponentOutlet['_moduleRef']);
193+
}));
196194

197-
fixmeIvy('FW-561: Runtime compiler is not loaded') &&
198-
it('should re-create moduleRef when changed', async(() => {
199-
const compiler = TestBed.get(Compiler) as Compiler;
200-
const fixture = TestBed.createComponent(TestComponent);
201-
fixture.componentInstance.module = compiler.compileModuleSync(TestModule2);
202-
fixture.componentInstance.currentComponent = Module2InjectedComponent;
203-
fixture.detectChanges();
195+
it('should re-create moduleRef when changed', async(() => {
196+
const compiler = TestBed.get(Compiler) as Compiler;
197+
const fixture = TestBed.createComponent(TestComponent);
198+
fixture.componentInstance.module = compiler.compileModuleSync(TestModule2);
199+
fixture.componentInstance.currentComponent = Module2InjectedComponent;
200+
fixture.detectChanges();
204201

205-
expect(fixture.nativeElement).toHaveText('baz');
202+
expect(fixture.nativeElement).toHaveText('baz');
206203

207-
fixture.componentInstance.module = compiler.compileModuleSync(TestModule3);
208-
fixture.componentInstance.currentComponent = Module3InjectedComponent;
209-
fixture.detectChanges();
204+
fixture.componentInstance.module = compiler.compileModuleSync(TestModule3);
205+
fixture.componentInstance.currentComponent = Module3InjectedComponent;
206+
fixture.detectChanges();
210207

211-
expect(fixture.nativeElement).toHaveText('bat');
212-
}));
208+
expect(fixture.nativeElement).toHaveText('bat');
209+
}));
213210
});
214211

215212
const TEST_TOKEN = new InjectionToken('TestToken');

packages/core/src/core_render3_private_export.ts

-3
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,9 @@ export {
114114
i18nEnd as ɵi18nEnd,
115115
i18nApply as ɵi18nApply,
116116
i18nPostprocess as ɵi18nPostprocess,
117-
WRAP_RENDERER_FACTORY2 as ɵWRAP_RENDERER_FACTORY2,
118117
setClassMetadata as ɵsetClassMetadata,
119118
} from './render3/index';
120119

121-
export { Render3DebugRendererFactory2 as ɵRender3DebugRendererFactory2 } from './render3/debug';
122-
123120

124121
export {
125122
compileComponent as ɵcompileComponent,

0 commit comments

Comments
 (0)