-
Notifications
You must be signed in to change notification settings - Fork 309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Promise flushing with fakeAsync
and tick
changed in v13.0.0
#1994
Comments
Yet another example which I think is related to the same root issue: // ✅ passes
it('should work', fakeAsync(async () => {
tick();
}));
// ❌ fails with:
// The code should be running in the fakeAsync zone to call this function
// at _getFakeAsyncZoneSpec (node_modules/zone.js/bundles/zone-testing-bundle.umd.js:5666:27)
it('should work', fakeAsync(async () => {
await Promise.resolve();
tick(); // <-- captured line
})); Previously, with |
I think I found the root cause which is #1788.
Adding @ahnpnl I think this is something worth mentioning in the release notes as it was quite difficult to reverse engineer this. I see this as a breaking change. |
Thanks for the investigation, I will update CHANGELOG. |
To be fair, it has been mentioned in the docs and in the README for release 29 😅
But I didn't think about downgrading the target of the test tsconfigs |
Version
13.0.0
Steps to reproduce
yarn install
examples/example-app-v14/src/app/app.component.spec.ts
node scripts/test-examples.js
Expected behavior
Tests run successfully, log output should be:
Actual behavior
Test fails with an error:
Log output looks out of order too, seems like the promise is resolved first when tests exits.
Additional context
This looks like a regression from v12.2.6 where the same test runs successfully and the promise is resolved after calling
tick
.This was first discovered after updating to nx v15.8.1 and reported there: nrwl/nx#15390
Environment
The text was updated successfully, but these errors were encountered: