Skip to content

Document fake async tests in zoneless mode, with vitest and jasmine #64962

@jnizet

Description

@jnizet

Describe the problem that you experienced

With zoneless becoming the default, fakeAsync can't be used anymore.

Besides, Angular will now support Vitest and Jasmine, which both provide different ways of faking timers/clock. And those fake timers/clock have an impact on whether await fixture.whenStable() will return or not.

To make it even more subtle and complex, Vitest browser mode has expect.element() which retries assertions every N milliseconds, and that of course is also interfering with fake timers.

It would be nice if the documentation revamped the section about fake async tests to illustrate common sccenarios, with those various frameworks:

  • a component delegating to a mock service returning a promise
  • a component using setTimeout, setInterval and RxJS delay() or debounceTime()

Enter the URL of the topic with the problem

https://angular.dev/guide/testing/components-scenarios#async-test-with-fakeasync

Describe what you were looking for in the documentation

No response

Describe the actions that led you to experience the problem

No response

Describe what you want to experience that would fix the problem

No response

Add a screenshot if that helps illustrate the problem

No response

If this problem caused an exception or error, please paste it here


If the problem is browser-specific, please specify the device, OS, browser, and version


Provide any additional information here in as much as detail as you can


Metadata

Metadata

Assignees

No one assigned

    Labels

    area: docsRelated to the documentation

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions