Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
37 views

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: // ...
Zachu's user avatar
  • 57
0 votes
0 answers
57 views

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 ...
Paulo Costa's user avatar
Advice
1 vote
1 replies
176 views

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 ...
Maarten's user avatar
  • 11
0 votes
1 answer
47 views

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: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯...
Qwertie's user avatar
  • 17.4k
-1 votes
1 answer
91 views

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 } ...
VariantAbdulaziz's user avatar
-4 votes
0 answers
63 views

I am using Vitest in browser mode, with Playwright as the provider. Whenever a test fails, a screenshot of the failed test is created in __screenshots__/<filename>/<test-name>. I am unsure ...
Joe's user avatar
  • 409
0 votes
1 answer
69 views

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:...
TalVik99's user avatar
  • 304
0 votes
0 answers
58 views

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....
Quentin's user avatar
  • 1,173
1 vote
0 answers
46 views

Problem I have a Vue project that uses Vuex for state management. Parts of the Vuex store are often mocked in unit tests (Vitest). When Vuex stores are defined in both the main production code and in ...
Neill's user avatar
  • 1,176
0 votes
2 answers
96 views

I have a function that allows users to register. After successful registration, the user is redirected to the home page (after 5 seconds). Before being redirected, the user receives a toast ...
Clyde's user avatar
  • 62
0 votes
1 answer
121 views

I'm testing components built with shadcn/ui, which uses Radix UI under the hood. When running UI interaction tests using Vitest and @testing-library/user-event, I keep getting the following error: ...
Palladio's user avatar
0 votes
1 answer
52 views

I am struggling adding mocked methods when testing a Pinia store's functionality. There is very little documentation relating to actually testing the stores themselves, as most Pinia's official ...
Vampuuri's user avatar
-1 votes
1 answer
68 views

In a large Vue 3 app, we have some helper modules that are imported into various components. One of these helpers returns the root node, which itself contains many other methods. In the app calls to ...
danwellman's user avatar
  • 9,401
0 votes
0 answers
19 views

I have a Vite app and configured a domain - say https://abcd.io:5173 - as a domain and certificates are generated for this domain. Now I would like to use MSW for testing. But when I try to enable ...
Abhilash D K's user avatar
  • 1,329
0 votes
0 answers
34 views

I'm working on my portfolio site, and learning how to write TypeScript and test scripts. I'm stuck resolving these errors: RUN v3.2.4 /Users/sigma/Documents/Websites/Site/Site 5 ❯ tests/lightbox....
herrjosua's user avatar
0 votes
1 answer
99 views

I’m trying to run Vitest with the UI enabled using: "scripts": { "test:ui": "vitest --ui" } When I run it with: npm run test:ui I get the following error: Error: ...
Cary Bondoc's user avatar
  • 3,016
1 vote
2 answers
154 views

I want to run Vitest tests in a monorepo. I'd like to distinguish between the tests of my different packages when running them, so I used the test.projects array in vitest.config.ts. To avoid listing ...
rozsazoltan's user avatar
  • 18.3k
0 votes
2 answers
128 views

I have a vitest test in the following form: beforeEach(async () => { // ??? }) describe('Subject Under Test', () => { test('should behave as expected', async () => { }); }); How ...
Noel Yap's user avatar
  • 19.9k
-4 votes
1 answer
66 views

When I use: describe("ExtractDateFromText", () => { test.for(scannedReceiptText)('Filename %s', async (expected) => { const dateResult = dateFromRawData(...
Mark Levison's user avatar
0 votes
2 answers
72 views

I’m trying to write a Vitest unit test for an auto-save feature in a Svelte 5 project. The test sets meta.settings.autoSaveIntervalMs = 50 so the save cycle finishes quickly, but the $effect still ...
henrymattel's user avatar
0 votes
1 answer
92 views

I have this very persistent problem which is very strange to me. It actually happened in a larger project but I isolated it in a very minimal project setup and the error keeps happening, hopefully ...
Jonas Holfeld's user avatar
-2 votes
1 answer
254 views

I’m trying to separate my TypeScript test configs for a Vite + React + Vitest project. The tsconfig.app.json and tsconfig.node.json files were created automatically by Vite; I only added my own ...
Basma Khalil's user avatar
1 vote
1 answer
51 views

In my snapshot, I have objects of the following format: { "meanElements": { "Om": 2.2835713400168607, "am": 1.3043985097733939, "em": 0.166565, ...
1valdis's user avatar
  • 1,144
0 votes
1 answer
93 views

I'm trying to test (using Vitest) a part of my Fastify app that uses @fastify/websocket (and transitively ws), but my tests keep timing out despite running to completion. Here's a relevant excerpt ...
JesseTG's user avatar
  • 2,195
2 votes
1 answer
38 views

I'm currently working on an existing React app and have to add Vitest to it. The problem I'm facing is that globals are injected using the inject function from @rollup/plugin-inject in my vite.config....
Ondo's user avatar
  • 23
1 vote
1 answer
133 views

I am using vitest with vitest-plugin-vis and playwright to perform visual testing in my Vite project. The issue I am facing is that the snapshots that are generated are only capturing part of my ...
MWB's user avatar
  • 1,899
-1 votes
1 answer
41 views

I was facing this exact error every time I tried to run a Nest project locally via VSCode and I didn't find anything related to it on the internet, so I'm gonna post a question and the answer I found ...
King Witcher's user avatar
0 votes
0 answers
182 views

I ran the following commands in sveltekit to create a new project npx sv create ch_ui I selected the following options ┌ Welcome to the Svelte CLI! (v0.8.20) │ ◇ Which template would you like? │ ...
PirateApp's user avatar
  • 6,362
0 votes
0 answers
57 views

I'm working on a Zod schema for nodes where each node got a unique ID, unique type and an array of child nodes. Because of that I created a helper function acting as a base schema for nodes function ...
baitendbidz's user avatar
  • 1,009
0 votes
0 answers
257 views

I am using React version 19 with Vite and when run Vitest, it's giving error FAIL src/components/UserPopover/UserPopover.test.tsx > UserPopover > calls only onCancel when "Cancel&...
Anand Deep Singh's user avatar
-1 votes
2 answers
267 views

While trying to execute unit tests with Vitest through Yarn in my Angular app I have an error about 'rollup' package : yarn run test [INFO] failed to load config from xxx\angular-test\vitest.config.ts ...
Benjamin C's user avatar
0 votes
0 answers
30 views

I'm trying to test a simple Inertia.js + React component using Vitest and React Testing Library. The component uses useForm() from @inertiajs/react and the route() helper function from Ziggy (Laravel)....
desh's user avatar
  • 699
3 votes
1 answer
281 views

I have a Next.js app that is running without any errors. However, I am using Vitest for my testing framework and when running a specific test (layout.test.tsx) it produces this error: FAIL src/app/...
JoeTidee's user avatar
  • 26.3k
1 vote
1 answer
1k views

I have code in which setTimeout is called repeatedly. Essentially the callback of one setTimout sets another one and so forth. I’d like to test the delays with vi.useFakeTimers() so that the code is ...
zwirbeltier's user avatar
0 votes
0 answers
58 views

I recently experienced a memory leak in my jest with ts-node tests in my Nestjs project. After debugging, all evidence pointed towards jest being the issue so I started to migrate to vitest, following ...
Finn Llewellyn's user avatar
0 votes
1 answer
77 views

I was going over Road to React (the book by Robin Wieruch), and I encountered a confusing piece of code. The code is on the Testing chapter, page 227: describe('App', () => { it('succeeds ...
Taofeek's user avatar
  • 53
0 votes
1 answer
171 views

i'm using Vitest test coverage and setting thresholds for the script to fail if the threshold values are greater than coverage values but it doesn't do anything. I have no idea what I'm doing wrong ...
yogi rajput's user avatar
0 votes
0 answers
35 views

I have a Nuxt composable that fetches data from Contentful using the contentful client's getEntries function. It's working on the frontend of my website but when I run my tests i'm getting: TypeError: ...
user2953989's user avatar
  • 3,039
0 votes
0 answers
35 views

I expected this test to fail, but it still passes. And i wonder how? I mocked the MSW requests expecting it to use the data i passed from in the server.use(...) it doesn't. it even passed with a wrong ...
Daniel Olatunde's user avatar
0 votes
1 answer
193 views

I have the following hook: function useWelcomeMessage() { const { data, error} = useGetWelcomeMessage(); const printMessage = useCallback(async () => { if (data) { alert(data) ...
Mark's user avatar
  • 2,031
0 votes
1 answer
165 views

The recommendation for i18n in Quasar is to add it to a boot file like this: import { defineBoot } from '#q-app/wrappers' import { createI18n } from 'vue-i18n' import messages from 'src/i18n' export ...
Murrah's user avatar
  • 1,750
1 vote
0 answers
45 views

I created a CLI with commander.js and I have some prompts like inputs etc. I want to test the prompts with unit testing, so for example to set a test value when a prompt is showing. So for example in ...
Jonathan Sigg's user avatar
1 vote
0 answers
104 views

I'm developing a SvelteKit application and I try to use Vitest to run some tests. I want to test a simple API endpoint: // src/routes/api/test/+server.ts import { testService } from '$lib/server/...
electrotype's user avatar
  • 8,895
0 votes
1 answer
77 views

I have a few commands with oclif whose tests fail with vitest but pass with jest. I believe something is off with the mocking. This is the structure: src/ commands/ foo-cmd.ts tests/ ...
gkri's user avatar
  • 2,041
3 votes
1 answer
375 views

this is my first post — I'm new to both Stack Overflow and SvelteKit. I'm trying to test a Svelte 5 Navbar component that conditionally shows links/buttons based on: page.data.user — if the user is ...
InternationalBonus16's user avatar
1 vote
1 answer
160 views

I'm using an env variable MY_VAR that I use from $env/static/public import { MY_VAR } from '$env/static/public'; export const myVar = MY_VAR === 'true'; I'd like to mock it in some tests, to support ...
Valentin Vignal's user avatar
6 votes
1 answer
2k views

After upgrading @mui/x-data-grid to version 8.1.0, I started encountering the following error while running unit tests using Vitest in my ReactJS application TypeError: Unknown file extension "....
Sundar's user avatar
  • 119
0 votes
0 answers
158 views

I am writing vitest tests that need http access to files in the public folder, which will be under the base url at production. What is a good way to accomplish this? I was hoping to find a plugin ...
Ed Staub's user avatar
  • 15.8k
4 votes
0 answers
272 views

Recently I read about new hook useSuspenseQuery provided in @tanstack/react-query v5. Previously I have used useQuery and have written unit tests on it. I am trying to write unit tests on ...
Dhananjay Sakhare's user avatar
6 votes
0 answers
742 views

My project folder structure is this: -frontend -src -components -__test__ -pages -dialogs - etc in __test__ folder there are all the test cases for components like ...
Muhammad Ahsan's user avatar

1
2 3 4 5
19