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
Replace Jest with Vitest #1574
Draft
ovidiuch
wants to merge
35
commits into
main
Choose a base branch
from
vitest
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Replace Jest with Vitest #1574
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Deploying with Cloudflare Pages
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an experiment, not sure how it will go.
Problems
require()
doesn't work in Vitest for thegetFixtures
test.Current status
2023-12-02
After running into a bunch of issues I'm pausing this PR for now. On one hand, most of the repo was easy to migrate to Vitest and running native ESM in tests is a great improvements–I can remove the
cjsMocks
folder and upgrade all Node dependencies that have recently upgraded to pure ESM. On the other hand, there are some blockers at the moment:getFixtures
works with sync require() and I don't know if it can be made to run in Vitest. I might refactor this API altogether and afterwards this problem will solve itself. But the refactor isn't trivial because we need a way to call it and generate test cases dynamically based on the returned fixture items. Last time I checked you couldn't asynchronously generate test cases (at least in Jest).packages/react-cosmos/src/devServer/__tests__/startDevServer.ts
test fails on Windows in Vitest (in GitHub Actions). I haven't tried in on a Windows machine yet, and it's hard to debug in GitHub actions. But weirdly if I run the test individually (just the failing test case or the entire test file, or even the entire package) they pass. It's only when I run the entire mono repo test suite that it fails. It's not obvious why and I'm wondering if Vitest is stable at this point.--no-threads
CLI arg but when I try it the CLI fails with aCACError: Unknown option --threads
exception.