tick() inside fakeAsync does not work when using vitest
Closed this issue · 1 comments
zargham-leanix commented
Hey,
We are trying to migrate some jest based tests to vitest but the cases where timing functions are used in fakeAsync
zone do not work. It fails with error message:
FAIL src/lib/repro/repro.component.spec.ts > ReproComponent > should create
Error: The code should be running in the fakeAsync zone to call this function
Here is how the test looks like:
it('should create', fakeAsync(async () => {
const component = await render(ReproComponent, {});
tick(1000);
expect(component).toBeTruthy();
}));
If same test is changed to TestBed
directly it does not fail. Any idea on why this is the case?
I have setup a minimal repo to reproduce this issue:
https://github.com/zargham-leanix/vitest-fake-async
zargham-leanix commented
It turns out the issue was not on @testing-library/angular side rather the angular plugin for vitest.
Fixed by analogjs/analog#1469