Skip to content

Importing a recursive cycle of standalone components into TestBed causes an infinite loop #49469

Closed

Description

@atscott

Which @angular/* package(s) are the source of the bug?

core

Is this a regression?

No

Description

Importing a recursive cycle of standalone components into TestBed.configureTestingModule causes an infinite loop in queueTypesFromModulesArrayRecur.

Please provide a link to a minimal reproduction of the bug

it('should render a recursive cycle of standalone components', () => {
@Component({
selector: 'cmp-a',
standalone: true,
template: '<ng-template [ngIf]="false"><cmp-c></cmp-c></ng-template>A',
imports: [forwardRef(() => StandaloneCmpC)],
})
class StandaloneCmpA {
}
@Component({
selector: 'cmp-b',
standalone: true,
template: '(<cmp-a></cmp-a>)B',
imports: [StandaloneCmpA],
})
class StandaloneCmpB {
}
@Component({
selector: 'cmp-c',
standalone: true,
template: '(<cmp-b></cmp-b>)C',
imports: [StandaloneCmpB],
})
class StandaloneCmpC {
}
const fixture = TestBed.createComponent(StandaloneCmpC);
fixture.detectChanges();
expect(fixture.nativeElement.textContent).toBe('((A)B)C');

Right before the TestBed.createComponent, add TestBed.configureTestingModule({imports: [StandaloneCmpC]});

Please provide the exception or error you saw


    RangeError: Maximum call stack size exceeded

    at queueTypesFromModulesArrayRecur

Activity

  1. added
    area: testing
    area: core
    cross-cutting: standalone
    on Mar 17, 2023
  2. modified the milestone: needsTriage on Mar 17, 2023
  3. changed the title [-]Importing[/-] [+]Importing a recursive cycle of standalone components into TestBed.configureTestingModule causes an infinite loop in[/+] on Mar 18, 2023
  4. changed the title [-]Importing a recursive cycle of standalone components into TestBed.configureTestingModule causes an infinite loop in[/-] [+]Importing a recursive cycle of standalone components into TestBed.configureTestingModule causes an infinite loop[/+] on Mar 18, 2023
  5. changed the title [-]Importing a recursive cycle of standalone components into TestBed.configureTestingModule causes an infinite loop[/-] [+]Importing a recursive cycle of standalone components into TestBed causes an infinite loop[/+] on Mar 18, 2023
  6. added
    P3
    on Mar 18, 2023
  7. modified the milestones: needsTriage, Backlog on Mar 18, 2023
  8. added a commit that references this issue on Mar 20, 2023
    bae6b5c
  9. angular-automatic-lock-bot commented on Apr 20, 2023

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  10. locked and limited conversation to collaborators on Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3area: corearea: testingcross-cutting: standalonestate: has PR

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions