-
Notifications
You must be signed in to change notification settings - Fork 20
Replace jest with vitest #421
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
Conversation
Includes all linting changes, helper methods and config files. Signed-off-by: Paul Sachs <psachs@buf.build>
747c3ac
to
8b03a44
Compare
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.
Jest is still hugely popular, but I think this is the right choice. Thanks for the migration! I'll merge this into the v2 branch.
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
test: { | ||
environment: "jsdom", |
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, did jest simply fix their environment?
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.
jest did so much stuff automatically. Eventually, we might take advantage of vitest's browser mode to actually run in the browser (like jasmine... software development is just a circle) and we can stop patching the dom, but for our purposes, this is fine.
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.
jest-environment-jsdom provides a DOM so that tests for web apps can run on Node.js. Awesome.
Unfortunately, it also removes the text encoding API from globals, which Node.js has been supporting for many years now. The problem is so bad that it forced us to create @bufbuild/jest-environment-jsdom
. It's a simple fix, but Jest has been sitting the problem out for years now, blaming jsdom.
Vitest does the same thing with environments, but it fixes the problem (see link above). Kudos to Vitest.
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.
Ah I understand what you meant now
Includes all linting changes, helper methods and config files.
This change cleans up a bunch of config and removes some warnings as well. Fixes #412