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
Centralize @babel/eslint-* tests #11106
Centralize @babel/eslint-* tests #11106
Conversation
40bf094
to
eb3f5d8
Compare
@@ -1,6 +0,0 @@ | |||
class ClassName { |
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 don't think this is actually being used anywhere?
}${message.ruleId ? ` ${message.ruleId}` : ""}`; | ||
const expectedMessage = expectedMessages[i]; | ||
|
||
if (expectedMessage instanceof RegExp) { |
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.
Added the ability to pass this function a RegExp
so we can enable the xit
ed test below.
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.
Can we use jest
's methods instead of writing our own errors checking logic?
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 think that would be great. Mind if we do that in a follow up PR?
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's ok!
eb3f5d8
to
4ce484d
Compare
verifyAndAssertMessages("{ , res }", {}, [ | ||
"1:3 Parsing error: Unexpected token", | ||
/1:2 Parsing error:.*Unexpected token \(1:2\)/, |
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 error reports an absolute file path, which is why I'm assuming it was disabled. With RegExp
support we can now enable this!
|
* Centralize @babel/eslint-* tests * Enable linting of @babel/eslint-* test files * Add missing sourceType
I've been trying to figure out how to structure tests (and which packages should be responsible for which tests), and have decided to advocate for the following:
@babel/eslint-parser
: Only tests the shape of the AST (and asserts that it matches Espree's)@babel/eslint-plugin
: Only test core rules that we have to create an@babel/*
copy of@babel/eslint-tests
: Integration/performance tests (typescript-eslint has a similar setup). This includes testing with ESLint itself, the ESLint core rules that we don't have to override, popular plugins, etc.I've moved all of the integration-y (by the definition above) tests into
@babel/eslint-tests
to centralize them there. Just to be clear,@babel/eslint-tests
should never be published. I made it a package because we need to install deps for testing.Thoughts/concerns?
I'm not sure why we weren't linting any of the
@babel/eslint-*
test files, but I enabled that as well.