Replies: 3 comments 3 replies
-
|
Hi Gregory, thanks for bringing this up. However, Vitest is designed to be running on Node only. The whole idea of this project is to run Vite on the Node side so you don't need to fire up the entire browser to run the test. I think for browser testing, Cypress or Web test runner could better fit the job (I'd personally recommend Vitest + Cypress, which both are using the same Vite engine to cover both units and e2e testing on Node and browser). Or, can you share more about what's your usage, and maybe we could see if it's could fit in Vitest's scope? To me personally snapshotting is an important feature that I found testing frameworks other than Jest are missing. In addition to having everything in the box, that's kinda what I love using Jest about. So I kinda targeting Vitest as an alternative to Jest with less coupled deps while making them work nicely together.
It's easy for us to expose them. But the important thing is that Vitest has to be running on Vite interpreted env (vite-node) but not native Node.js. I haven't thought about the programmatic API yet, but maybe we could in the future.
We could do that, but I am not sure if
Yes. That's something left to do, PR welcome :) |
Beta Was this translation helpful? Give feedback.
-
|
Thanks @antfu and other contributors for vitest. It's a great project. I made something sort of similar (which I was actually going to call vitest 😅) that patched jest to to allow a custom runner that runs the tests with puppeteer https://github.com/taye/vijest. It uses synchronous XHR in the browser to communicate with the test runner and have snapshots and reading from the FS with the usual jest APIs. I'd be very happy to try adding something similar to vitest as I think for some cases:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello @patak-js , @antfu , congrats great work around jest, it's refreshing.
I tried to integrate vitest inside our browser testing implementation, I had some issues 😦 Here is some issues I had during my integration:
https://imgur.com/a/jex9gTJ
and here is the snippet of code I use now for being able to run vitest in the browser https://gist.github.com/gqio/404001da5333d86f408e79ba19e33c8f
Sorry for the reporter not being very neat but at least it adapts my actual front report api and the vitest runner api 🙂
FTR I commented in the run module those lines to avoid bundling issue on my side
Maybe splitting core feature and runtime could fit the need.
Wdyt ?
Beta Was this translation helpful? Give feedback.
All reactions