Thanks to visit codestin.com
Credit goes to github.com

Skip to content

use fixture.whenStable() instead of fixture.detectChanges() for zoneless applications #31193

@robertIsaac

Description

@robertIsaac

Command

add, generate

Description

for new project that has selected zoneless, the generated unit test file should follow the guide
https://angular.dev/guide/zoneless#using-zoneless-in-testbed
as it mention

avoid using fixture.detectChanges() when possible
but since the generated ones already have them most people will forget, or not even know that they should instead using fixture.whenStable

Describe the solution you'd like

  1. new projects should have the app.spec.ts file use fixture.whenStable
  2. generated components should not have fixture.detectChanges() added at beforeEach
  3. generated components should have await fixture.whenStable() added at beforeEach

Describe alternatives you've considered

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions