@@ -14,80 +14,87 @@ describeKarmaBuilder(execute, KARMA_BUILDER_INFO, (harness, setupTarget) => {
1414 beforeEach ( async ( ) => {
1515 await setupTarget ( harness ) ;
1616 } ) ;
17+
1718 it ( 'should initialize components imported through a barrel' , async ( ) => {
18- harness . useTarget ( 'test' , { ...BASE_OPTIONS , include : [ 'src/app/repro/**/*.spec.ts' ] } ) ;
19+ harness . useTarget ( 'test' , {
20+ ...BASE_OPTIONS ,
21+ include : [ 'src/app/repro/**/*.spec.ts' ] ,
22+ } ) ;
23+
1924 await harness . writeFiles ( {
2025 'src/app/repro/layout/layout.ts' : `
21- import { Component } from '@angular/core';
22- @Component({ selector: 'app-layout', template: '<ng-content />' })
23- export class Layout {}
24- ` ,
26+ import { Component } from '@angular/core';
27+ @Component({ selector: 'app-layout', template: '<ng-content />' })
28+ export class Layout {}
29+ `,
2530 'src/app/repro/layout/index.ts' : `
26- export * from './layout';
27- ` ,
31+ export * from './layout';
32+ `,
2833 'src/app/repro/a/dialog.ts' : `
29- import { Component } from '@angular/core';
30- import { Layout } from '../layout';
31- @Component({
32- selector: 'app-dialog',
33- imports: [Layout],
34- template: '<app-layout>dialog</app-layout>',
35- })
36- export class Dialog {}
37- ` ,
34+ import { Component } from '@angular/core';
35+ import { Layout } from '../layout';
36+ @Component({
37+ selector: 'app-dialog',
38+ imports: [Layout],
39+ template: '<app-layout>dialog</app-layout>',
40+ })
41+ export class Dialog {}
42+ `,
3843 'src/app/repro/c/page.ts' : `
39- import { Component } from '@angular/core';
40- import { Layout } from '../layout';
41- @Component({
42- selector: 'app-page',
43- imports: [Layout],
44- template: '<app-layout>page</app-layout>',
45- })
46- export class Page {}
47- ` ,
44+ import { Component } from '@angular/core';
45+ import { Layout } from '../layout';
46+ @Component({
47+ selector: 'app-page',
48+ imports: [Layout],
49+ template: '<app-layout>page</app-layout>',
50+ })
51+ export class Page {}
52+ `,
4853 'src/app/repro/a/dialog.spec.ts' : `
49- import { TestBed } from '@angular/core/testing';
50- import { Dialog } from './dialog';
51- describe('a/dialog.spec.ts', () => {
52- it('creates', () => {
53- TestBed.configureTestingModule({ imports: [Dialog] });
54- expect(TestBed.createComponent(Dialog).componentInstance).toBeTruthy();
55- });
56- });
57- ` ,
54+ import { TestBed } from '@angular/core/testing';
55+ import { Dialog } from './dialog';
56+ describe('a/dialog.spec.ts', () => {
57+ it('creates', () => {
58+ TestBed.configureTestingModule({ imports: [Dialog] });
59+ expect(TestBed.createComponent(Dialog).componentInstance).toBeTruthy();
60+ });
61+ });
62+ `,
5863 'src/app/repro/a/dialog-again.spec.ts' : `
59- import { TestBed } from '@angular/core/testing';
60- import { Dialog } from './dialog';
61- describe('a/dialog-again.spec.ts', () => {
62- it('creates', () => {
63- TestBed.configureTestingModule({ imports: [Dialog] });
64- expect(TestBed.createComponent(Dialog).componentInstance).toBeTruthy();
65- });
66- });
67- ` ,
64+ import { TestBed } from '@angular/core/testing';
65+ import { Dialog } from './dialog';
66+ describe('a/dialog-again.spec.ts', () => {
67+ it('creates', () => {
68+ TestBed.configureTestingModule({ imports: [Dialog] });
69+ expect(TestBed.createComponent(Dialog).componentInstance).toBeTruthy();
70+ });
71+ });
72+ `,
6873 'src/app/repro/c/page.spec.ts' : `
69- import { TestBed } from '@angular/core/testing';
70- import { Page } from './page';
71- describe('c/page.spec.ts', () => {
72- it('creates', () => {
73- TestBed.configureTestingModule({ imports: [Page] });
74- expect(TestBed.createComponent(Page).componentInstance).toBeTruthy();
75- });
76- });
77- ` ,
74+ import { TestBed } from '@angular/core/testing';
75+ import { Page } from './page';
76+ describe('c/page.spec.ts', () => {
77+ it('creates', () => {
78+ TestBed.configureTestingModule({ imports: [Page] });
79+ expect(TestBed.createComponent(Page).componentInstance).toBeTruthy();
80+ });
81+ });
82+ `,
7883 'src/app/repro/b/other.spec.ts' : `
79- import { TestBed } from '@angular/core/testing';
80- import { Layout } from '../layout/layout';
81- describe('async spec', () => {
82- it('creates', async () => {
83- TestBed.configureTestingModule({ imports: [Layout] });
84- await Promise.resolve();
85- expect(TestBed.createComponent(Layout).componentInstance).toBeTruthy();
86- });
87- });
88- ` ,
84+ import { TestBed } from '@angular/core/testing';
85+ import { Layout } from '../layout/layout';
86+ describe('async spec', () => {
87+ it('creates', async () => {
88+ TestBed.configureTestingModule({ imports: [Layout] });
89+ await Promise.resolve();
90+ expect(TestBed.createComponent(Layout).componentInstance).toBeTruthy();
91+ });
92+ });
93+ `,
8994 } ) ;
95+
9096 const { result } = await harness . executeOnce ( ) ;
97+
9198 expect ( result ?. success ) . toBeTrue ( ) ;
9299 } ) ;
93100 } ) ;
0 commit comments