test: migrate jest -> node:test
Description
Migrate jest to nodejs internal test runer
Validation
all test should pass
Related Issues
#6123
Check List
- [X] I have read the Contributing Guidelines and made commit messages that follow the guideline.
- [ ] I have run
npx turbo lintto ensure the code follows the style guide. And runnpx turbo lint:fixto fix the style errors if necessary. - [ ] I have run
npx turbo formatto ensure the code follows the style guide. - [ ] I have run
npx turbo testto check if all tests are passing. - NA I've covered new added functionality with unit tests if necessary.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| nodejs-org | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Nov 25, 2023 10:22pm |
hummmm something strange I din't get any error for other test (not migrated yet).
I mean node didn't read-it
but on junit.xml it's output error for these tests 🤔
hummmm something strange I din't get any error for other test (not migrated yet).
I mean node didn't read-it
but on
junit.xmlit's output error for these tests 🤔
Wdym? Is it not generating junit.xml when passing the right args?
Wdym? Is it not generating junit.xml when passing the right args?
on terminal it's doesn't output any error but on junit.xml it's write error. Alors if I remove **/__tests__/*.test.mjs there any issue it's display correctly
huston we go a problem. TSX loader doesn't support jsx REF
I'm deep diving @educandu/node-jsx-loader a jsx loader
huston we go a problem. TSX loader doesn't support jsx REF I'm deep diving
@educandu/node-jsx-loadera jsx loader
I'm deep diving @educandu/node-jsx-loader a jsx loader
Afaik it does... Why do you think it doesn't? It should support React natively :)
I even have seen users using it with React in the past (I also used it with React in the past, so I wonder what errors you're hitting?)
@ovflowd I think there's been a misunderstanding. tsx and tsc are loaders that allow you to interpret typescript. But neither of them understands JSX. That's why I looked at @educandu/node-jsx-loader. It supports JSX but not TSX. So I'm still looking for what/how. Also if a component imports style with CSS module node will try to load it.
@ovflowd I think there's been a misunderstanding. tsx and tsc are loaders that allow you to interpret typescript. But neither of them understands JSX. That's why I looked at
@educandu/node-jsx-loader. It supports JSX but not TSX. So I'm still looking for what/how. Also if a component imports style with CSS module node will try to load it.
Again, you're wrong. tsx is a loader that supports JSX. tsc/esm is a loader that does not support JSX. tsx uses esbuild and supports jsx. You can even see that the codebase supports those extensions: https://github.com/search?q=repo%3Aprivatenumber%2Ftsx%20jsx&type=code
gotcha !!!
gotcha !!!
If you're still struggling, please feel free to share errors. We're here to help.
Any progress over here? 👀
I'ill come back in now I have time 😀
I'm getting trouble with react test. with module css nodejs can't load file
I'm getting trouble with react test.
with module css nodejs can't load file
Can you share the errors?
I think we truly dont care about css imports; So probably we should stub/mock these imports... I know esbuild supports css and probably css modules by default, but I doubt it is something we really want to import.
@nodejs/loaders does anyone here know how we can stub/mock part of the module resolution process?
More specifically some of our files import .css files but we definitely dont want to load them with the Node.js Test Runner (node:test) and we're using "--import=tsx" that adds a loader for TypeScript and React (JSX).
Should we make another loader just to stub these CSS imports or is there something else we can do here? Like a builtin functionality to simply stub these imports?
I think I found a solution for my own question. https://github.com/coderaiser/mock-import
👆 this might help you, Augustin.
(Im also assuming https://www.npmjs.com/package/sinon can do the trick) as the state of node:test mocking and spying is kinda supbar atm (the whole thing is still experimental. We could definitely raise a feature request on node core
cc @nodejs/test_runner)
I use Testdouble to do this in a pure ESM environment.
Lots of git conflicts are listed below...
Closing because it's too old. And I can't rebase GitHub desktop just crash. an new branch is WIP https://github.com/nodejs/nodejs.org/tree/test-node if someone with write access can help. But let me know.