Closed daviddesmet closed 2 years ago
I am encountering the same issue using react-app-ts example on Windows, running with npm
I have the same with a react and typescript app with vice 2.6.3
jest
cannot resolve @/
path.
jest.config.js
to fix this.
+ moduleNameMapper: {
+ '^@/(.*)$': '<rootDir>/src/$1',
+ },
I have written more about this in my article https://dev.to/imomaliev/creating-vite-vue-ts-template-setup-jest-5h1i
I think this issue is fixed in v0.1.4 now. The issue existed because previously there was no reliable way to start the test till Vite optimizes all the dependencies, therefore tests may start too early with some dependencies still compiling. It's no longer an issue in the latest version.
First of all, thanks a lot for your hard work on supporting jest on vite.
When I first setup the project with vite-jest, my tests were working again, felt like magic, however, I noticed jest wasn't exiting and instead giving me this message:
Since this issue was getting the commits stuck due to a git hook that runs unit tests, I decided to investigate further in order to solve it.
I gave it a try with
--detectOpenHandles
but didn't got any additional output. I even tried passing--forceExit
with no luck.I excluded some tests and even wrote a simple one and still got the same issue.
After a lot of trial and error... I ended removing the
node_modules
directory and installed all packages all over again and now the unit tests are failing with the above-mentioned message.This is my test file:
Any hints on what is causing it and how I can make it work again? And also fix the issue about jest not exiting.