Vitest to be able to run native node:test tests #6482
Replies: 3 comments 4 replies
-
I've created some PoC ThePlenkov/node-test-with-anything#1 the idea is following
and hooks.mjs is
So idea is that it shoud execute vitest instead of node:test However currently I have a following error:
|
Beta Was this translation helpful? Give feedback.
-
Vitest is not a simple script you can just replace your other test runner with. Vitest requires its own module context to transform modules with Vite and store the global state.
If you for some reason just want to replace one module with another (redirect |
Beta Was this translation helpful? Give feedback.
-
@sheremet-va Thank you for a quick reply Vladimir. Actually I have tried it works
I understand that vitest api is different from node:test API, but may be as an idea for vitest team to think of something like
where vitest:node is a node:test compatible vitest API. Theroretically must not be that much work to have, but in this case you'll be able to onboard quickly devs from other frameworks which are using native node api. |
Beta Was this translation helpful? Give feedback.
-
Hi! I have a following idea
I would like to write test in framework independent way just using node:test package, I'm able to run those tests with
node --test
command.Now I want to see how my tests behave with vitest. So what I expect:
npx vitest
What do you think of this proposal?
Beta Was this translation helpful? Give feedback.
All reactions