-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
detect improper use of t.throws #742
detect improper use of t.throws #742
Conversation
Protects against a common misuse of t.throws (Like that seen in avajs#739). This required the creation of a custom babel plugin. https://github.com/jamestalmage/babel-plugin-ava-throws-helper
'You should wrap the following expression in a function:', | ||
' %s', | ||
'Like this:', | ||
' function() {\n %s\n }', |
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.
Promote arrow functions?
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.
I considered that.
But if the user is green enough that that they don't fully understand how throw
works, I was concerned about piling on another abstraction they need to understand.
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.
Yea fair enough.
👍
#404? |
Perhaps displaying relative path would be better and would align with our "clean stack traces" feature. |
9a6d76a
to
dbed3d4
Compare
I know it is an overkill, but would be incredibly cool to have syntax highlight in errors (not just this one). |
I think maybe the middle section:
Is kinda useless with the codeframe right above. |
Super awesome! |
Marvelous. |
Cool! Should update the default plugin sections in the readme and babelrc recipe. |
I went with just the |
👍 |
🎉 |
🍾✨ |
Protects against a common misuse of t.throws (Like that seen in #739).
This required the creation of a custom babel plugin.
https://github.com/jamestalmage/babel-plugin-ava-throws-helper
Sample output:
The linked documentation isn't that helpful. We should probably make a short recipe about this. (maybe a
common-mistakes
recipe? This seems like too small a topic for a whole recipe). We can update the URL when that recipe is written.