Open redzimskidev opened 5 months ago
Not sure what's going on here because there is a 1.3.1
version of Vitest
Ahh, I see the issue. We add an incorrect version to the package.json
https://github.com/analogjs/analog/blob/beta/packages/nx-plugin/src/generators/setup-vitest/versions/ng_17_X/versions.ts#L8 should be ^1.3.1
If you can share the test repo that would help. I'm able to run the tests after adjusting the version and changing vite.config.ts to vite.config.mts
npx @angular/cli@latest new angular-analog-vitest
cd angular-analog-vitest
npm i @analogjs/platform --save-dev
ng g @analogjs/platform:setup-vitest --project angular-analog-vitest
(Update package.json to ^1.3.1 after npm install error)
npm i
Rename vite.config.ts to vite.config.mts
npm run test
HI @brandonroberts, thank you for quick reply.
I found the issue and it's a weird one - it fails only when there are spaces in the project's path. I have spaces in the name of my repository, so it failed there, and when I created an app called analog-vitest-error-repro it failed. When I rename the directory to analog vitest error repro it's failing with the same issue my repository does. Here's a repository with a folder with spaces: https://github.com/redzimskidev/analog-vitest-error-repro
I tried recreating the bug with github actions but it seems spaces break that too(or I can't figure it out).
I see, that is weird. We fixed the issues with running the schematic, but that wouldn't resolve this.
Please provide the environment you discovered this bug in.
I can't reproduce it - I've run the same commands on codesandbox.io and it works fine there. However, I tried creating a new Angular app and running the same app on a different machine and both resulted in issues.
On two machines I own, running ng new, adding Vitest as documented and fixing the issues mentioned in the description result in the error in the title.
Which area/package is the issue in?
Don't know / other
Description
I can't reproduce it - I've run the same commands on codesandbox.io and it works fine there. However, I tried creating a new Angular app and running the same app on a different machine and both resulted in issues.
Two issues I encountered running the commands:
ng g @analogjs/platform:setup-vitest --project [your-project-name]
adds vitest 1.31.1 to package.json which can't be installed because this version doesn't exist. I assumed it was meant to be 1.3.1, after changing and running npm i I get an error about not being able to use ESBuild modules - I might remember wrong, but the solution was to change extension of vite.config from ts to mts. Those errors also happened on codesandbox so they probably don't cause my issue.It's probably more of a question than a bug since I know the code works on codesandbox, but I have no idea whatsoever what causes it to fail on my machines.
Please provide the exception or error you saw
Other information
No response
I would be willing to submit a PR to fix this issue