-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add eslint-plugin-jest
to @wordpress/scripts
#17061
Comments
In #17033, there is change to the recommended config included as well. It adds all Jest related rules to all files which Jest would match as test files. So it sort of works the other way around than you propose. I has the same issue when trying to add tests to Gutenberg examples repository here: WordPress/gutenberg-examples#84. |
Thanks, but I don't see any changes to the "recommended config" in this PR |
I meant changes highlighted here: #17027 (comment). I shared a wrong PR 🙃 |
I hope to release the next major version of @wordpress/scripts next Wednesday/Thursday which should fix it. Let’s reopen only in case when it doesn’t work as expected afterward. |
@ntwb - new major version of Related PR where I test it: WordPress/gutenberg-examples#87 |
I filed a new issue in ESLint: eslint/eslint#12278. |
It looks like the fix in ESLint is going to be breaking change and would eventually land in 7.0: eslint/rfcs#37. We will need a temporary fix. I think it's fine to always enable configs for unit and e2e tests in |
Not sure on the timeline but there is broad support for a rework of the ESLint configuration as outlined in eslint/rfcs#9 That, if agreed to would also land in a major release of ESLint, possibly 7.0 |
It only confirms my assumption that we need to have a working solution in the meantime as it might take months before we see 7.0 :) |
A temporary workaround is ready with #17744. I don't think it makes sense to wait until ESLint 7.0 is out as it might take some time. |
Should we close it now that #17744 was merged? We will be able to revisit it after eslint/rfcs#37 is implemented but it might take months. |
Yup, closing 👍🏼 |
The upstream issue was fixed eslint/eslint#12887 in ESLint but we need until v7.0.0 is out. |
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
In the process of updating
stylelint-config-wordpress
to use@wordpress/scripts
ESLint reports a bunch ofno-undef
errors for the test files in the/__tests__/
folder, for example:Describe the solution you'd like
A clear and concise description of what you want to happen.
The
@wordpress/scripts
package already includes Jest for running unit and e2e tests and as such I would expect that writing tests with Jest should include the ESLint Jest rules also.Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
The alternate solution is to install
eslint-plugin-jest
in thestylelint-config-wordpress
repo instead and add an ESLint configuration.The #17027 PR comes close to solving the above solution by adding a new ESLint ruleset
@wordpress/eslint-plugin/test-unit
that includes Jest.The issue with that as it currently stands is it does not inherit the current
@wordpress/eslint-plugin/recommended
ruleset.cc @gziolo
The text was updated successfully, but these errors were encountered: