Here you didn't mentioned about the configurations in the "vitest.config.ts" it's not detecting the "jest-dom" lib from the vite.config.ts.
It needs vitest.config.ts
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
globals: true, // this allows me to use describe, it, expect anywhere within the project without importing them
setupFiles: './tests/setup.ts',
environment: 'jsdom',
include: ['*/.{test,spec}.{js,ts,tsx,jsx}'],
},
});
Now everything will work
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Here you didn't mentioned about the configurations in the "vitest.config.ts" it's not detecting the "jest-dom" lib from the vite.config.ts.
It needs vitest.config.ts
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
globals: true, // this allows me to use describe, it, expect anywhere within the project without importing them
setupFiles: './tests/setup.ts',
environment: 'jsdom',
include: ['*/.{test,spec}.{js,ts,tsx,jsx}'],
},
});
Now everything will work