This commit is contained in:
8
src/pages/__tests__/DashboardPage.test.tsx
Normal file
8
src/pages/__tests__/DashboardPage.test.tsx
Normal file
@ -0,0 +1,8 @@
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import { DashboardPage } from '../DashboardPage'
|
||||
import { expect, test } from 'vitest'
|
||||
|
||||
test('renders dashboard headline', () => {
|
||||
render(<DashboardPage />)
|
||||
expect(screen.getByText(/Välkommen till HemHub/i)).toBeInTheDocument()
|
||||
})
|
||||
@ -27,5 +27,12 @@
|
||||
"baseUrl": ".",
|
||||
"paths": { "@/*": ["src/*"] }
|
||||
},
|
||||
"include": ["src"]
|
||||
"include": ["src/**/*"],
|
||||
"exclude": [
|
||||
"src/**/*.test.ts",
|
||||
"src/**/*.test.tsx",
|
||||
"src/**/*.spec.ts",
|
||||
"src/**/*.spec.tsx",
|
||||
"src/**/__tests__/**"
|
||||
],
|
||||
}
|
||||
|
||||
@ -1,7 +1,12 @@
|
||||
import { defineConfig } from 'vitest/config'
|
||||
import { defineConfig } from 'vitest/config'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import tsconfigPaths from 'vite-tsconfig-paths'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [tsconfigPaths()],
|
||||
test: { environment: 'jsdom', setupFiles: ['./vitest.setup.ts'] },
|
||||
plugins: [react(), tsconfigPaths()], // 👈 viktigt
|
||||
test: {
|
||||
environment: 'jsdom',
|
||||
setupFiles: ['./vitest.setup.ts'],
|
||||
globals: true,
|
||||
},
|
||||
})
|
||||
|
||||
@ -0,0 +1,2 @@
|
||||
// vitest.setup.ts
|
||||
import '@testing-library/jest-dom/vitest'
|
||||
Reference in New Issue
Block a user