Ajouts de configuration pour les tests dans les fichiers vite.config et vitest.c…
…onfig.m + ajout du premier fichier de test MovieGender.spec.ts.
Showing
4 changed files
with
43 additions
and
11 deletions
test/components/MovieGender.spec.ts
0 → 100644
| 1 | +//#region --Import--. | ||
| 2 | +import { describe, expect, it } from "vitest"; | ||
| 3 | +import { mount } from "@vue/test-utils"; | ||
| 4 | +import MovieGender from "../../components/details/MovieGender.vue"; | ||
| 5 | +//#endregion | ||
| 6 | + | ||
| 7 | +describe("MovieGender", () => { | ||
| 8 | + // todo : ajouter les tests ici. | ||
| 9 | + it("component renders properly", () => { | ||
| 10 | + const wrapper = mount(MovieGender); | ||
| 11 | + // expect(wrapper.text()).toContain("Hello world"); | ||
| 12 | + expect(wrapper.text()); | ||
| 13 | + }); | ||
| 14 | +}); |
| @@ -5,7 +5,7 @@ export default { | @@ -5,7 +5,7 @@ export default { | ||
| 5 | plugins: [vue()], | 5 | plugins: [vue()], |
| 6 | test: { | 6 | test: { |
| 7 | globals: true, | 7 | globals: true, |
| 8 | - environment: "jsdom", | 8 | + environment: "happy-dom", |
| 9 | // Additional test configurations can be added here | 9 | // Additional test configurations can be added here |
| 10 | }, | 10 | }, |
| 11 | } | 11 | } |
| 1 | import { defineVitestConfig } from '@nuxt/test-utils/config' | 1 | import { defineVitestConfig } from '@nuxt/test-utils/config' |
| 2 | +import vue from '@vitejs/plugin-vue' | ||
| 3 | +import { fileURLToPath } from 'node:url' | ||
| 2 | 4 | ||
| 3 | export default defineVitestConfig({ | 5 | export default defineVitestConfig({ |
| 4 | /** | 6 | /** |
| @@ -7,15 +9,30 @@ export default defineVitestConfig({ | @@ -7,15 +9,30 @@ export default defineVitestConfig({ | ||
| 7 | */ | 9 | */ |
| 8 | test: { | 10 | test: { |
| 9 | environment: 'nuxt', | 11 | environment: 'nuxt', |
| 12 | + globals: true, | ||
| 10 | // you can optionally set Nuxt-specific environment options | 13 | // you can optionally set Nuxt-specific environment options |
| 11 | - // environmentOptions: { | 14 | + environmentOptions: { |
| 12 | - // nuxt: { | 15 | + nuxt: { |
| 13 | - // rootDir: fileURLToPath(new URL('./playground', import.meta.url)), | 16 | + rootDir: fileURLToPath(new URL('./', import.meta.url)), |
| 14 | - // domEnvironment: 'happy-dom', // 'happy-dom' (default) or 'jsdom' | 17 | + domEnvironment: 'happy-dom', // 'happy-dom' (default) or 'jsdom' |
| 15 | - // overrides: { | 18 | + overrides: { |
| 16 | - // // other Nuxt config you want to pass | 19 | + // other Nuxt config you want to pass |
| 17 | - // } | 20 | + }, |
| 18 | - // } | 21 | + mock: { |
| 19 | - // } | 22 | + intersectionObserver: true, |
| 23 | + indexedDb: true, | ||
| 24 | + } | ||
| 25 | + }, | ||
| 26 | + }, | ||
| 27 | + coverage: { | ||
| 28 | + provider: 'v8', | ||
| 29 | + reporter: ['text', 'json', 'html'], | ||
| 30 | + } | ||
| 31 | + }, | ||
| 32 | + resolve: { | ||
| 33 | + alias: { | ||
| 34 | + '~': fileURLToPath(new URL('./', import.meta.url)), | ||
| 35 | + '@': fileURLToPath(new URL('./', import.meta.url)), | ||
| 36 | + } | ||
| 20 | } | 37 | } |
| 21 | }) | 38 | }) |
-
Please register or login to post a comment