In the Angular ecosystem, there are a few recommended tools used to run unit tests including Karma, Jasmine, and Jest. Karma and Jasmine have been ...
For further actions, you may consider blocking this person and/or reporting abuse
Does your Angular application need to also be an Analog application to utilize the analogjs/vite-plugin-angular, or can any angular app use vitest with that plugin for testing?
Great question. Any Angular application can use the Vite plugin with Vitest for testing. It doesn't have to be an Analog application.
That's great, but in this case - would it be possible to make a schematic for ng add?
Sure, its possible. It could do
And it could give you a prompt to setup Vitest support for you
In a normal Angular app do we have to install analog to be able to use vitest?
Currently, yes. There's no official support from the Angular team for Vitest. As previously commented, you can only use Analog for the testing integration if you prefer.
It won't increase my build?
Hello Brandon, great content. Is there an option to use Cypress instead of Playwright?
Thanks Mateus. Currently, Cypress is not an option for browser testing. The list of currently supported options is here.
vitest.dev/guide/browser#cross-bro...
Hi, installed the NPM package without issues, but when trying to configure vitest with:
ng g @analogjs/platform:setup-vitest --project my-project-name
I get an error: Cannot read properties of undefined (reading 'root')
What I'm doing wrong? As "my-project-name" I'm using the value of the property "name" in the package.json file.
Thanks in advance,
Agv
You should use the name of your project from the
angular.json
fileHow can I add vitest to nx multi app?
the command :
nx g @nx/angular:ng-add @analogjs/platform --project project-name
not working for me
The correct command after installing the package is
What about code coverage. How do you setup code coverage with ViteTest in Angular?
Does this needs require rxjs version 7+?
i just found out using jsdom and happy-dom it only works with rxjs 7+
using Playwright it works with rxjs 6.x
not sure if this is issue with analogjs or vite/vitest
with jsdom and happy-dom