-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[jest] refactor config check #135960
[jest] refactor config check #135960
Conversation
Pinging @elastic/kibana-operations (Team:Operations) |
💛 Build succeeded, but was flakyFailed CI StepsMetrics [docs]
History
To update your PR or re-run it, just comment with: |
💔 All backports failed
Manual backportTo create the backport manually run:
Questions ?Please refer to the Backport tool documentation |
Friendly reminder: Looks like this PR hasn’t been backported yet. |
We received a report from the core team that some of their tests were executing multiple times. This lead to discovering that the current config check improperly required that config files were included in places where they are not needed, causing many test files to be tested twice on CI.
The issue stems from an attempt to be helpful and tell contributors where config files should live. Unfortunately, as things have changed and we have needed to split up jest configs, this logic grew incorrect. I've tried to fix it several times but I'm tired of trying to make it work and don't think that jest config creation is something most people need a lot of help with anymore (especially once we get to packages for all the things).
This PR reworks that check to flip the logic around a bit, find all the jest test and config files in the repo, then use Jest APIs to determine the list of test files for each Jest config. Any test that isn't selected by a jest config will produce an error, and any test file that is selected by multiple configs will also produce an error.
IMO this is a much simpler thing to write correctly, and the logic seems sound to me for now.
Gist of the errors found by this PR before deleting config files: https://gist.github.com/spalger/be739eb4290756df4be83dd6b5410d51