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
[BUG] - @testdeck/vitest is relying on commonjs module #322
Comments
@Lukinoh Thank you very much for the quick feedback. I have to look into this as testdeck is meant for being used in both the browser and node. |
@Lukinoh Which version of vitest are you using? Looking at vitest-dev/vitest#325 |
I made a typo in my ticket. You can find my small project with the bug here: https://stackblitz.com/edit/vitejs-vite-rqocxq?file=package.json But concretely what seems to happen is that "@testdeck/vitest" loads the file index.cjs of vite which is empty. |
I have looked into this. Importing from ESM into CJS modules is quite tricky and requires a top level await, i.e.
While this works after the fact, i.e. the dist/index.js file is patched, it will not work when transpiling with tsc, as it requires |
Importing from CJS into ESM seems to be working, though. So maybe just making |
As vitest is thought to be ESM first, it would make sense to me. |
Testdeck Version
0.3.0
Testdeck Package
@testdeck/vite
NodeJS Version
Mocha / Jasmine / Jest / Vitest Version
Operating System
Actual Behaviour
I tried to use @testdeck/vitest on a small project, but it does not work because the build provided by testdeck is using commonjs, and vitest is not compatible with commonjs.
You can reproduce the issue easily on your repository by using the build output in your tests :
If you modify the
tsconfig.json
by"module": "commonjs"
"moduleResolution": "node"
It will work, in your tests.
Expected Behaviour
It should not rely on commonjs, otherwise, it won't work natively with vitest.
The text was updated successfully, but these errors were encountered: