Skip to content
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

[expect-expect] reports the entire test as erroneous #539

Closed
DanielSWolf opened this issue Feb 25, 2020 · 2 comments · Fixed by #1452
Closed

[expect-expect] reports the entire test as erroneous #539

DanielSWolf opened this issue Feb 25, 2020 · 2 comments · Fixed by #1452

Comments

@DanielSWolf
Copy link

Within each unit test, the actual expect statement usually follows some amount of setup. As long as I'm writing this setup code, the test is technically invalid according to the expect-expect rule because it doesn't include any expects. However, this means that about 80% of the time I spend writing unit tests, the entire function I'm writing is disfigured with red squigglies:

image

This doesn't just look bad. It also hides any actual errors I may have made. Only when I type the first expect do I see whether there are any other problems with my code.

Would it be possible for this rule to report only part of the test function as erroneous? For instance, just the it? Here's a mockup of how this might look:

image

@G-Rath
Copy link
Collaborator

G-Rath commented Feb 25, 2020

@DanielSWolf we report the callback as being node that is erroneous, as that is where the error lies (not in the test expression).

You'll want to create a new issue for your editor, as we don't control how the errors are rendered.

For reference, IntelliJ/WebStorm does render the error as you'd like:

image

To be honest, I'd like to report the callback rather than the it node, as it's a pretty overloaded node (in the screenshot above, there are four errors on it).

@github-actions
Copy link

🎉 This issue has been resolved in version 27.4.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants