913 questions
-1
votes
0
answers
86
views
How to test a component that uses useActionState hook? [closed]
I've been trying to get my test case that includes useActionState() and <form action={}> to pass.
The scenario is as follows:
When the "add balance" button is clicked, a <Modal/>...
-1
votes
0
answers
38
views
How to do integration testing in Nuxt 4 / Nitro routes with vitest?
tldr: I can't get nuxt 4 / nitro to do integration testing with vitest
Coming from Express.js and Supertest, I pretty much understand that I need a running server/app that will accept requests and ...
Best practices
0
votes
0
replies
12
views
is it ok to mock the controller when using MSW?
The Vitest course I'm following shows a way to test a function that talks to an external server. The MSW was introduced, after that the instructor said: "we have no way to make the MSW handler's ...
1
vote
0
answers
85
views
Unable to debug test
I've just moved from Jasmine and Karma to Vitest in my Angular 21 frontend project.
The migration went smoothly, and I now have all my tests running correctly inside a Chromium browser.
Here is my ...
2
votes
0
answers
257
views
Angular Vitest not working in Test Explorer - Need to call TestBed.initTestEnvironment() first
Why is it that when I run Angular Vitest tests in the terminal is works fine:
But running the same tests in the Test Explorer fails:
I tried adding
import { BrowserTestingModule, ...
1
vote
1
answer
260
views
Angular Vitest multiple configurations to do remote debugging locally and run headless in pipeline
Since Angular version 21 it uses Vitest as default testing framework. I come from Karma + Jasmine and we had a customLauncher in our karma configuration file with the --remote-debugging-port=9333 flag ...
1
vote
0
answers
115
views
How do I resolve a typescript compiler conflict between vitest and NGXS
I have an Angular 21 project in which I am using NGXS for state management. I was using jest as a testing framework but vitest works better.
The issue is that the NGXS @Selector() decorator is showing ...
Advice
0
votes
3
replies
67
views
How to use a separate classes (stubs) in vitest?
I've migrated my angular 21 tests from jasmine to vitest. And for some of my tests I use separate helper classes (like Page object models). For example:
export class SignUpPageObject {
constructor(...
0
votes
1
answer
222
views
Initializing service values before tests using Angular 21 and Vitest
I've just moved over to Angular 21 and started using Vitest.
I'd like to initialize one of my services before the tests starts.
So I added provideAppInitializer in src/test-providers.ts like so:
// ...
0
votes
0
answers
189
views
Angular 21 Vitest, FakeTimers and RxJS debounceTime
I could successfully migrate my Angular 20/Jasmine/Karma app to Angula r21/Vitest
All my tests are running correctly, except the ones that use debounceTime from RxJS
As a workaround for now, ny unit ...
Advice
1
vote
1
replies
401
views
Angular: Vitest vs Jasmine/Karma
I am a bit confused with the Angular testing landscape. I have seen that Vitest will become the new default, replacing Karma. The question I then have is what about Jasmine. Does Vitest replace only ...
0
votes
1
answer
62
views
How to fix ERR_INVALID_URL_SCHEME when initializing C# in WebAssembly in node.js?
While I was able to get my C# code running in the browser as WebAssembly, I get errors like this when trying to run any (vitest) unit tests that load the module that initializes .NET:
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯...
0
votes
1
answer
217
views
Alias import issues in Vitest
I'm trying to have Vitest + Storybook setup and the following is my vitest.config.ts:
import path from "path";
import { fileURLToPath } from "node:url";
import { defineConfig } ...
0
votes
1
answer
95
views
Vitest config for Laravel and Vue
I have a Laravel 12 project built with the Vue starter kit. By default, the project didn't have any frontend testing libraries. I want to add tests in Vitest. When I run vitest, I get the error: Error:...
0
votes
0
answers
75
views
Type error not caught in vitest.config.ts
When writing a Vitest config file in TypeScript, type errors don't seem to be caught. How to change that (and thus benefit from type checking if an option property is wrong)?
Here's an example vitest....