-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Improve async handling in generated code #18783
Conversation
f03b493
to
a529bcc
Compare
The “floating” promises are intended. See: #17652 (comment) |
Unfortunately the PR mentioned in that comment (#15472) is closed. I can't find any documentation or plan on how this will be fixed/resolved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had a chat around this yesterday during our team meeting and doing this change shouldn't break Protractor. Therefore this should be good to go after
- Update the commit message scopes to
@schematics/angular
- Dropping Jasmine bump commit since this seems redundant.
expect(page.getTitleText()).toEqual('integration-project app is running!'); | ||
it('should display welcome message', async () => { | ||
await page.navigateTo(); | ||
await expect(await page.getTitleText()).toEqual('integration-project app is running!'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The outer await should not be needed here and in the other tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tsconfig.json.template
file in packages/schematics/angular/e2e/files
specifies jasminewd2
in types. The method signatures in these type definitions return Promises. So I believe this change is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It returns a promise because it's a generic, therefore if you await
the return type is no longer a promise.
declare function expect<T>(actual: ArrayLike<T>): jasmine.ArrayLikeMatchers<T>;
Method returning Promise should be async Rationale: https://palantir.github.io/tslint/rules/promise-function-async/
Avoid floating promises Rationale: https://palantir.github.io/tslint/rules/no-floating-promises/
Fixed these remarks and rebased the PR. |
Thank you for the contribution. This change has, however, been superseded by #18951. This will be available in the upcoming version 11. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This PR fixes two tslint errors in generated projects: