-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
test: Simplify Jest config and expand coverage #25013
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
443d685
to
0c04e01
Compare
This comment was marked as resolved.
This comment was marked as resolved.
d6bc055
to
f9029b7
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #25013 +/- ##
===========================================
- Coverage 70.44% 69.62% -0.83%
===========================================
Files 1274 1344 +70
Lines 44080 47795 +3715
Branches 12453 13190 +737
===========================================
+ Hits 31051 33273 +2222
- Misses 13029 14522 +1493 ☔ View full report in Codecov by Sentry. |
Builds ready [6d47993]
Page Load Metrics (165 ± 224 ms)
Bundle size diffs
|
7ac6963
to
5c1b2f5
Compare
Builds ready [5c1b2f5]
Page Load Metrics (124 ± 148 ms)
Bundle size diffs
|
Rebased to resolve conflicts, and the Mocha test coverage list has been removed because it was now empty. |
Builds ready [154d349]
Page Load Metrics (49 ± 3 ms)
Bundle size diffs
|
Our Mocha and Jest configuration has been messy because we're in the middle of a migration from Mocha to Jest. Each file had to be explicitly included in the Jest configuration or ignored in the Mocha configuration. This was inconvenient and error-prone, and resulted in some tests not being run at all. Both test configurations have been updated to use a shared list of Mocha test files. There are only a few of these files left, and this list should only get shorter as we migrate more tests to Jest. No further configuration changes will be needed to add Jest tests.
More conflicts to resolve. Moving into draft (CI passes but it shouldn't, this is reducing test coverage). |
'<rootDir>/app/scripts/migrations/*.ts', | ||
'!<rootDir>/app/scripts/migrations/*.test.(js|ts)', | ||
'<rootDir>/app/scripts/platforms/*.js', | ||
'<rootDir>/app/scripts/**/*.(js|ts|tsx)', |
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.
wow, nice
Builds ready [dda8b8c]
Page Load Metrics (45 ± 4 ms)
Bundle size diffs
|
Description
Our Mocha and Jest configuration has been messy because we're in the middle of a migration from Mocha to Jest. Each file had to be explicitly included in the Jest configuration or ignored in the Mocha configuration. This was inconvenient and error-prone, and resulted in some tests not being run at all.
Both test configurations have been updated to use a shared list of Mocha test files. There are only a few of these files left, and this list should only get shorter as we migrate more tests to Jest. No further configuration changes will be needed to add Jest tests.We have now finished migrating unit tests from Mocha to Jest, so this PR now only affects the Jest configuration.
Note that the ESLint configuration has not been updated to use these simpler globs to determine which tests use Mocha and which use Jest. I tried doing that in this PR initially but it raised too many lint errors, so that will come in a later PR. In the meantime, we may still need to update
.eslintrc.js
when adding a new test of either type.Related issues
N/A
Manual testing steps
Run
yarn test:unit
and verify that it runs correctly (no errors, no missing tests)Screenshots/Recordings
N/A
Pre-merge author checklist
Pre-merge reviewer checklist