chore: move all packages away from jest#156
Conversation
cc0957e to
c561cda
Compare
| argv, | ||
| parallel, | ||
| } from "just-scripts"; | ||
| import { tscTask, esbuildTask, eslintTask, parallel } from "just-scripts"; |
There was a problem hiding this comment.
Any opinions on if we need/want a just-scripts task for vitest?
There was a problem hiding this comment.
I don't think we need it. In general I am not the biggest fan of this abstraction layer especially that unless configured, it doesn't allow passing more arguments to a command. I personally find it confusing and it doesn't bring value, sharing config is anyway done through just by extending default config in each package.
However, if someone could show me some clear benefits, I am open to changing my mind
There was a problem hiding this comment.
Agreed with that, I phrased it as a question to not anchor the comment.
| @@ -1,7 +1,14 @@ | |||
| /** | |||
| * @vitest-environment node | |||
There was a problem hiding this comment.
For my own curiosity and anyone reading next :)
https://vitest.dev/guide/environment.html#environments-for-specific-files
This PR is logical continuation of #150 - we in scope of this PR migrate away from using jest in the repository completely. Here are some performance numbers between jest and vitest, for script doing the benchmark check the gist. Pasting here for convenience:
Vitest:
Jest (before moving most tests in
examplesto stories):Notes:
yarnand immediately after started running testsWe can see 3-4 times fast perf on smaller packages and ~20% improvement faster in bigger much (with much higher amount of tests, because now all stories are included) and ~45% faster cold start, on newly checked out repo.
Some additional benefits:
testverb no longer depends onbuildortypesas vitest doesn't have limitations like ts-jestvitest-browser-reactwith similar but a bit nicer API with playwright like capabilitiesSome additional changes:
bubbleandtriggerto be instances of jest mock for variant of util exposed to unit tests. As we now want to support both, instead of having default mock, we just give an option to pass mock from your testing framework of choice. In 1JS we don't depend on that behavior but in semantic versioning this needs to be a major bumpvite-plugin-commonjs(cc @ansemb) by first replacingrequirestatement when loading schema and then by removingvite-plugin-relayand related Babel plugin by replacing it with@swc/plugin-relayto align more with tools used in our outside repositories.