-
Notifications
You must be signed in to change notification settings - Fork 24
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
feat: Setup Vitest #3201
feat: Setup Vitest #3201
Conversation
Bundle ReportChanges will increase total bundle size by 179 bytes ⬆️
|
Bundle ReportChanges will increase total bundle size by 34 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #3201 +/- ##
==========================================
+ Coverage 98.14% 99.10% +0.96%
==========================================
Files 932 799 -133
Lines 14482 13975 -507
Branches 3958 3960 +2
==========================================
- Hits 14213 13850 -363
+ Misses 264 117 -147
- Partials 5 8 +3
... and 140 files with indirect coverage changes
Continue to review full report in Codecov by Sentry.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #3201 +/- ##
================================================
+ Coverage 98.14000 99.10000 +0.96000
================================================
Files 932 799 -133
Lines 14482 13975 -507
Branches 3877 3965 +88
================================================
- Hits 14213 13850 -363
+ Misses 264 117 -147
- Partials 5 8 +3
... and 140 files with indirect coverage changes
Continue to review full report in Codecov by Sentry.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #3201 +/- ##
==========================================
+ Coverage 98.14% 99.10% +0.96%
==========================================
Files 932 799 -133
Lines 14482 13975 -507
Branches 3958 3965 +7
==========================================
- Hits 14213 13850 -363
+ Misses 264 117 -147
- Partials 5 8 +3
... and 140 files with indirect coverage changes
Continue to review full report in Codecov by Sentry.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #3201 +/- ##
==========================================
+ Coverage 98.14% 99.10% +0.96%
==========================================
Files 932 799 -133
Lines 14482 13975 -507
Branches 3958 3960 +2
==========================================
- Hits 14213 13850 -363
+ Misses 264 117 -147
- Partials 5 8 +3
... and 140 files with indirect coverage changes
Continue to review full report in Codecov by Sentry.
|
✅ Deploy preview for gazebo ready!Previews expire after 1 month automatically.
|
2bae740
to
fac7172
Compare
.github/workflows/ci.yml
Outdated
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 will likely affect our after_n_builds
setting in codecov. Not a huge deal though.
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.
fine with living with this until we move over to vitest completely
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.
Oh wait you already updated it LOL. In that case, we should just remember to update it when we're done the transition.
ctx.status(200), | ||
ctx.data({ me: { owner: { isAdmin: true } } }) | ||
graphql.query('owner', (info) => { | ||
return HttpResponse.json( |
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.
Codecov is showing me line coverage for this file, which is unexpected.
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.
Yeaaa the test files were being included in the coverage reporting, this should be fixed. It was also causing downstream issues
<IconSvg className={cs(iconClass ? iconClass : IconClasses[size])} /> | ||
<IconSvg | ||
className={cs(iconClass ? iconClass : IconClasses[size])} | ||
data-testid={`${name}-svg`} |
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 is a massive W
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.
So with Vite + Vitest, it actually inlines the svg's so our old way of trying to grab them with findByText('icon.svg)
just doesn't work hah
|
||
export default setupTestGlobal | ||
|
||
process.env.REACT_APP_ZOD_IGNORE_TESTS = 'true' |
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.
what does this do?
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.
Copied over from the Jest test setups ... something I believe @ajay-sentry added in.
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.
lgtm couple notes/questions
Description
This PR introduces Vitest to the codebase. Vitest will only run tests that end in
*.test.*
whereas CRACO will run tests that end in*.spec.*
. If you want to write a test for Vitest, it must end in*.test.*
. Alongside the addition of Vitest, we're also migrating to MSW V2, reason being ... V1 doesn't work with Vitest, and the codemod didn't work out for migrating our Jest MSW mocks over.This PR also contains examples for:
Here's a link to the MSW migration docs: https://mswjs.io/docs/migrations/1.x-to-2.x
Ticket: codecov/engineering-team#2126
Notable Changes
codecov.yml
to ignore files that we can't easily test like images