-
Notifications
You must be signed in to change notification settings - Fork 230
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
fix-405 #406
Conversation
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.
This is not the correct fix - we just don't have any tests for async
functions.
E.g. this works correctly if added to invalid
tests to master, but fails on this branch
{
code: `
it('test function', async () => {
Builder.getPromiseBuilder().get().build().then((data) => expect(data).toEqual('Hi'));
});
`,
errors: [{ column: 11, endColumn: 96, messageId: 'returnPromise' }],
},
It's just a copy of another invalid
test, but with added async
keyword
😬 my apologies - for some reason I thought we had I've implemented the proper solution :) |
Could we verify all non- |
More than happy to tomorrow morning (it's 12am here) - also happy if you want to push to this branch :)
|
will do. thanks! |
const body = getFunctionBody(functionExpression); | ||
|
||
if (body.type !== AST_NODE_TYPES.BlockStatement) { | ||
return false; |
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.
not covered
return value.expression.type === AST_NODE_TYPES.AwaitExpression; | ||
} | ||
|
||
return false; |
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.
not covered
@SimenB The uncovered lines are not actually coverable w/o some more refactoring. We can "cover" the second Having re-read the material, I think the problem here is that this rule is actually meant to be about expects inside promises; so The problem in this case is that we bail out if the |
@SimenB Have you had a chance to look over this yet? (just in case the email got lost again 😂) |
I haven't - super crunch at work for the last month...
Can we recurse until we hit the (I haven't re-read this or the issue, so context is missing atm) |
what's the current status here? |
😬 I believe the status is that I think we're got a rule that's overreaching and so coming up a bit short:
Looking at the tests & the issue, I think it should be that I'm a little bit of two minds on this, but I think that's because it's a bit of a confusing one to follow what with
If you remove the
Currently |
@SimenB have you had a chance to look over my last comment? |
🎉 This issue has been resolved in version 24.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This issue has been resolved in version 25.0.0-next.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I'm not entirely sure why this is needed, as it doesn't seem to be different from
espree
.Still, all the tests are now passing, so I call it a win.
Fixes #405