diff --git a/components/blocks/LeaderboardInfo/Desktop/Desktop.test.ts b/components/blocks/LeaderboardInfo/Desktop/Desktop.test.ts index d0bb9757..5c841c62 100644 --- a/components/blocks/LeaderboardInfo/Desktop/Desktop.test.ts +++ b/components/blocks/LeaderboardInfo/Desktop/Desktop.test.ts @@ -1,5 +1,3 @@ -import { afterEach, describe, expect, it, vi } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import { getByTestId } from 'root/testUtils' import Desktop from './Desktop.vue' diff --git a/components/blocks/LeaderboardInfo/LeaderboardInfo.test.ts b/components/blocks/LeaderboardInfo/LeaderboardInfo.test.ts index c640c67e..897899e1 100644 --- a/components/blocks/LeaderboardInfo/LeaderboardInfo.test.ts +++ b/components/blocks/LeaderboardInfo/LeaderboardInfo.test.ts @@ -1,5 +1,3 @@ -import { afterEach, describe, expect, it, vi } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import { getByTestId } from 'root/testUtils' import LeaderboardInfo from './LeaderboardInfo.vue' diff --git a/components/blocks/LeaderboardInfo/Mobile/Mobile.test.ts b/components/blocks/LeaderboardInfo/Mobile/Mobile.test.ts index 7110b038..fce62d74 100644 --- a/components/blocks/LeaderboardInfo/Mobile/Mobile.test.ts +++ b/components/blocks/LeaderboardInfo/Mobile/Mobile.test.ts @@ -1,5 +1,3 @@ -import { afterEach, describe, expect, it, vi } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import { getByTestId } from 'root/testUtils' import Mobile from './Mobile.vue' diff --git a/components/blocks/LeaderboardInfo/PlatformTags/PlatformTags.test.ts b/components/blocks/LeaderboardInfo/PlatformTags/PlatformTags.test.ts index 249448f1..1331bded 100644 --- a/components/blocks/LeaderboardInfo/PlatformTags/PlatformTags.test.ts +++ b/components/blocks/LeaderboardInfo/PlatformTags/PlatformTags.test.ts @@ -1,5 +1,3 @@ -import { describe, expect, it } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import PlatformTags from './PlatformTags.vue' diff --git a/components/blocks/ProfileHeader/ProfileHeader.test.ts b/components/blocks/ProfileHeader/ProfileHeader.test.ts index e93ab390..0ae4b989 100644 --- a/components/blocks/ProfileHeader/ProfileHeader.test.ts +++ b/components/blocks/ProfileHeader/ProfileHeader.test.ts @@ -1,5 +1,3 @@ -import { describe, expect, it } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import ProfileHeader from './ProfileHeader.vue' diff --git a/components/blocks/ProfileHeader/UserActivity/UserActivity.test.ts b/components/blocks/ProfileHeader/UserActivity/UserActivity.test.ts index f266968f..e97f9450 100644 --- a/components/blocks/ProfileHeader/UserActivity/UserActivity.test.ts +++ b/components/blocks/ProfileHeader/UserActivity/UserActivity.test.ts @@ -1,5 +1,3 @@ -import { describe, expect, it } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import UserActivity from './UserActivity.vue' diff --git a/components/blocks/ProfileHeader/UserBadges/UserBadges.test.ts b/components/blocks/ProfileHeader/UserBadges/UserBadges.test.ts index 0b20fd58..4507f39d 100644 --- a/components/blocks/ProfileHeader/UserBadges/UserBadges.test.ts +++ b/components/blocks/ProfileHeader/UserBadges/UserBadges.test.ts @@ -1,5 +1,3 @@ -import { describe, expect, it } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import UserBadges from './UserBadges.vue' diff --git a/components/blocks/SearchBar/SearchBar.test.ts b/components/blocks/SearchBar/SearchBar.test.ts index 3c4c40c4..38c06a79 100644 --- a/components/blocks/SearchBar/SearchBar.test.ts +++ b/components/blocks/SearchBar/SearchBar.test.ts @@ -1,5 +1,3 @@ -import { describe, expect, it } from 'vitest' - /* eslint-disable @typescript-eslint/ban-ts-comment */ import { mountSuspended } from '@nuxt/test-utils/runtime' import SearchBar from './SearchBar.vue' diff --git a/components/blocks/SiteFooter/LanguageSelector/LanguageSelector.test.ts b/components/blocks/SiteFooter/LanguageSelector/LanguageSelector.test.ts index 2e6d6d9b..bc6ca42a 100644 --- a/components/blocks/SiteFooter/LanguageSelector/LanguageSelector.test.ts +++ b/components/blocks/SiteFooter/LanguageSelector/LanguageSelector.test.ts @@ -1,5 +1,3 @@ -import { describe, expect, it } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import { supportedLocales } from 'root/configUtils' import LanguageSelector from './LanguageSelector.vue' diff --git a/components/blocks/SiteFooter/SiteFooter.test.ts b/components/blocks/SiteFooter/SiteFooter.test.ts index 8a44dbeb..0c2b011a 100644 --- a/components/blocks/SiteFooter/SiteFooter.test.ts +++ b/components/blocks/SiteFooter/SiteFooter.test.ts @@ -1,5 +1,3 @@ -import { describe, expect, it } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import SiteFooter from './SiteFooter.vue' diff --git a/components/blocks/cards/BasicAlert/BasicAlert.test.ts b/components/blocks/cards/BasicAlert/BasicAlert.test.ts index 2feae71c..84cae064 100644 --- a/components/blocks/cards/BasicAlert/BasicAlert.test.ts +++ b/components/blocks/cards/BasicAlert/BasicAlert.test.ts @@ -1,5 +1,3 @@ -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import { getByClass, getByTestId, getHTMLElement } from 'root/testUtils' import BasicAlert from './BasicAlert.vue' @@ -7,9 +5,9 @@ import BasicAlert from './BasicAlert.vue' beforeEach(() => { const { state: modalAlertState } = useModalAlert() modalAlertState.value = { + title: 'A test alert?', body: 'This is a test', show: true, - title: 'A test alert?', type: 'info', } }) diff --git a/components/blocks/cards/ForgotPasswordCard/ForgotPasswordCard.test.ts b/components/blocks/cards/ForgotPasswordCard/ForgotPasswordCard.test.ts index ae953280..8bdad174 100644 --- a/components/blocks/cards/ForgotPasswordCard/ForgotPasswordCard.test.ts +++ b/components/blocks/cards/ForgotPasswordCard/ForgotPasswordCard.test.ts @@ -1,4 +1,3 @@ -import { afterAll, describe, expect, it, vi } from 'vitest' import { mockNuxtImport, mountSuspended } from '@nuxt/test-utils/runtime' import { getByTestId } from 'root/testUtils' import ForgotPasswordCard from './ForgotPasswordCard.vue' diff --git a/components/blocks/cards/LogInCard/LogInCard.test.ts b/components/blocks/cards/LogInCard/LogInCard.test.ts index bb0124c0..43cfba74 100644 --- a/components/blocks/cards/LogInCard/LogInCard.test.ts +++ b/components/blocks/cards/LogInCard/LogInCard.test.ts @@ -1,5 +1,3 @@ -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import { getByTestId, getHTMLElement } from 'root/testUtils' import LogInCard from './LogInCard.vue' diff --git a/components/blocks/cards/SignUpCard/SignUpCard.test.ts b/components/blocks/cards/SignUpCard/SignUpCard.test.ts index 5edc3db2..5eee1b79 100644 --- a/components/blocks/cards/SignUpCard/SignUpCard.test.ts +++ b/components/blocks/cards/SignUpCard/SignUpCard.test.ts @@ -1,5 +1,3 @@ -import { afterEach, describe, expect, it, vi } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import { getByTestId, getHTMLElement } from 'root/testUtils' import SignUpCard from './SignUpCard.vue' diff --git a/components/blocks/nav/SiteNavbar/SiteNavbar.test.ts b/components/blocks/nav/SiteNavbar/SiteNavbar.test.ts index 4021942e..9ade2086 100644 --- a/components/blocks/nav/SiteNavbar/SiteNavbar.test.ts +++ b/components/blocks/nav/SiteNavbar/SiteNavbar.test.ts @@ -1,5 +1,3 @@ -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import * as apiComposables from 'composables/api' import { getByTestId } from 'root/testUtils' diff --git a/components/elements/buttons/ButtonLink/ButtonLink.test.ts b/components/elements/buttons/ButtonLink/ButtonLink.test.ts index 58eb7a36..f6121c04 100644 --- a/components/elements/buttons/ButtonLink/ButtonLink.test.ts +++ b/components/elements/buttons/ButtonLink/ButtonLink.test.ts @@ -1,5 +1,3 @@ -import { describe, expect, it } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import ButtonLink from './ButtonLink.vue' diff --git a/components/elements/buttons/Dropdown/Dropdown.test.ts b/components/elements/buttons/Dropdown/Dropdown.test.ts index b5cb9e8d..935341c2 100644 --- a/components/elements/buttons/Dropdown/Dropdown.test.ts +++ b/components/elements/buttons/Dropdown/Dropdown.test.ts @@ -1,5 +1,3 @@ -import { describe, expect, it } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import { getByTestId } from 'root/testUtils' import Dropdown from './Dropdown.vue' diff --git a/components/elements/buttons/Dropdown/DropdownItem.test.ts b/components/elements/buttons/Dropdown/DropdownItem.test.ts index 9f5d17b2..588dc63a 100644 --- a/components/elements/buttons/Dropdown/DropdownItem.test.ts +++ b/components/elements/buttons/Dropdown/DropdownItem.test.ts @@ -1,5 +1,3 @@ -import { describe, expect, it } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import { getByTestId } from 'root/testUtils' import DropdownItem from './DropdownItem.vue' diff --git a/components/elements/buttons/FollowButton/FollowButton.test.ts b/components/elements/buttons/FollowButton/FollowButton.test.ts index 7ff1f20f..bf5af7eb 100644 --- a/components/elements/buttons/FollowButton/FollowButton.test.ts +++ b/components/elements/buttons/FollowButton/FollowButton.test.ts @@ -1,5 +1,3 @@ -import { describe, expect, it } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import FollowButton from './FollowButton.vue' diff --git a/components/elements/buttons/HideShowPassword/HideShowPassword.test.ts b/components/elements/buttons/HideShowPassword/HideShowPassword.test.ts index c655f4e4..c8d6ac0b 100644 --- a/components/elements/buttons/HideShowPassword/HideShowPassword.test.ts +++ b/components/elements/buttons/HideShowPassword/HideShowPassword.test.ts @@ -1,5 +1,3 @@ -import { describe, expect, it } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import { getByTestId, getHTMLElement } from 'root/testUtils' import HideShowPassword from './HideShowPassword.vue' diff --git a/components/elements/buttons/SocialButtons/SocialButtons.test.ts b/components/elements/buttons/SocialButtons/SocialButtons.test.ts index 1a8d4516..868edfc8 100644 --- a/components/elements/buttons/SocialButtons/SocialButtons.test.ts +++ b/components/elements/buttons/SocialButtons/SocialButtons.test.ts @@ -1,5 +1,3 @@ -import { describe, expect, it } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import SocialButtons from './SocialButtons.vue' diff --git a/components/elements/inputs/PasswordInput/PasswordInput.test.ts b/components/elements/inputs/PasswordInput/PasswordInput.test.ts index 4f8e50ba..1b1834ed 100644 --- a/components/elements/inputs/PasswordInput/PasswordInput.test.ts +++ b/components/elements/inputs/PasswordInput/PasswordInput.test.ts @@ -1,5 +1,3 @@ -import { afterEach, describe, expect, it, vi } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import { getHTMLElement } from 'root/testUtils' import PasswordInput from './PasswordInput.vue' diff --git a/components/elements/modals/BaseModal/BaseModal.test.ts b/components/elements/modals/BaseModal/BaseModal.test.ts index 05a79b85..61a91c85 100644 --- a/components/elements/modals/BaseModal/BaseModal.test.ts +++ b/components/elements/modals/BaseModal/BaseModal.test.ts @@ -1,5 +1,3 @@ -import { afterEach, describe, expect, it } from 'vitest' - import { mount, enableAutoUnmount } from '@vue/test-utils' import BaseModal from './BaseModal.vue' diff --git a/components/elements/nav/NavLinks/NavLink/NavLink.test.ts b/components/elements/nav/NavLinks/NavLink/NavLink.test.ts index de2491d2..e54274f5 100644 --- a/components/elements/nav/NavLinks/NavLink/NavLink.test.ts +++ b/components/elements/nav/NavLinks/NavLink/NavLink.test.ts @@ -1,5 +1,3 @@ -import { describe, expect, it } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import NavLink from './NavLink.vue' diff --git a/components/elements/nav/NavLinks/NavLinks.test.ts b/components/elements/nav/NavLinks/NavLinks.test.ts index 5b02e1cb..88462275 100644 --- a/components/elements/nav/NavLinks/NavLinks.test.ts +++ b/components/elements/nav/NavLinks/NavLinks.test.ts @@ -1,4 +1,3 @@ -import { afterEach, describe, expect, it } from 'vitest' import { mount, enableAutoUnmount } from '@vue/test-utils' import NavLinks from './NavLinks.vue' diff --git a/composables/api/useChangePassword/useChangePassword.test.ts b/composables/api/useChangePassword/useChangePassword.test.ts index 74b9fad2..e02898f2 100644 --- a/composables/api/useChangePassword/useChangePassword.test.ts +++ b/composables/api/useChangePassword/useChangePassword.test.ts @@ -1,5 +1,3 @@ -import { describe, expect, it, vi } from 'vitest' - const mockSuccessRecoverCreate2 = vi.fn(() => Promise.resolve({ ok: true })) describe('useChangePassword', () => { diff --git a/composables/api/useConfirmAccount/useConfirmAccount.test.ts b/composables/api/useConfirmAccount/useConfirmAccount.test.ts index 4663dec9..8aed4c8f 100644 --- a/composables/api/useConfirmAccount/useConfirmAccount.test.ts +++ b/composables/api/useConfirmAccount/useConfirmAccount.test.ts @@ -1,5 +1,3 @@ -import { describe, expect, it, vi } from 'vitest' - const mockSuccessAccountConfirmation = vi.fn(() => Promise.resolve({ ok: true }), ) diff --git a/composables/api/useGetLeaderboardDetail/useGetLeaderboardDetail.test.ts b/composables/api/useGetLeaderboardDetail/useGetLeaderboardDetail.test.ts index d7582af8..d1d3592d 100644 --- a/composables/api/useGetLeaderboardDetail/useGetLeaderboardDetail.test.ts +++ b/composables/api/useGetLeaderboardDetail/useGetLeaderboardDetail.test.ts @@ -1,5 +1,3 @@ -import { describe, expect, it, vi } from 'vitest' - const mockSuccessLeaderboardsDetail = vi.fn(() => Promise.resolve({ ok: true })) describe('useGetLeaderboardDetail', () => { diff --git a/composables/api/useGetUserDetail/useGetUserDetail.test.ts b/composables/api/useGetUserDetail/useGetUserDetail.test.ts index bfc02b56..e11c6ee4 100644 --- a/composables/api/useGetUserDetail/useGetUserDetail.test.ts +++ b/composables/api/useGetUserDetail/useGetUserDetail.test.ts @@ -1,5 +1,3 @@ -import { describe, expect, it, vi } from 'vitest' - const mockSuccessUsersDetail = vi.fn(() => Promise.resolve({ ok: true })) describe('useGetUserDetail', () => { diff --git a/composables/api/useLoginUser/useLoginUser.test.ts b/composables/api/useLoginUser/useLoginUser.test.ts index 13e2a36d..7a69cc18 100644 --- a/composables/api/useLoginUser/useLoginUser.test.ts +++ b/composables/api/useLoginUser/useLoginUser.test.ts @@ -1,4 +1,3 @@ -import { afterEach, describe, expect, it, vi } from 'vitest' // const mockFailureUsersLoginCreate = vi.fn(() => Promise.resolve({ ok: false })) const mockSuccessAccountLoginCreate = vi.fn(() => Promise.resolve({ data: { token: 'token' }, ok: true }), diff --git a/composables/api/useLogoutUser/useLogoutUser.test.ts b/composables/api/useLogoutUser/useLogoutUser.test.ts index 15ef540e..6beca90f 100644 --- a/composables/api/useLogoutUser/useLogoutUser.test.ts +++ b/composables/api/useLogoutUser/useLogoutUser.test.ts @@ -1,4 +1,3 @@ -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { UserViewModel } from 'lib/api/data-contracts' const token = 'auth-token' diff --git a/composables/api/useRecoverAccount/useRecoverAccount.test.ts b/composables/api/useRecoverAccount/useRecoverAccount.test.ts index f0c7c0c6..c4aa0791 100644 --- a/composables/api/useRecoverAccount/useRecoverAccount.test.ts +++ b/composables/api/useRecoverAccount/useRecoverAccount.test.ts @@ -1,5 +1,3 @@ -import { describe, expect, it, vi } from 'vitest' - const mockSuccessRecoverCreate = vi.fn(() => Promise.resolve({ ok: true })) describe('useRecoverAccount', () => { diff --git a/composables/api/useRegisterUser/useRegisterUser.test.ts b/composables/api/useRegisterUser/useRegisterUser.test.ts index b2329188..b2806e46 100644 --- a/composables/api/useRegisterUser/useRegisterUser.test.ts +++ b/composables/api/useRegisterUser/useRegisterUser.test.ts @@ -1,5 +1,3 @@ -import { describe, expect, it, vi } from 'vitest' - const mockSuccessRegisterCreate = vi.fn(() => Promise.resolve({ ok: true })) describe('useRegisterUser', () => { diff --git a/composables/api/useResendAccountConfirmation/useResendAccountConfirmation.test.ts b/composables/api/useResendAccountConfirmation/useResendAccountConfirmation.test.ts index 66a893ae..c534cd92 100644 --- a/composables/api/useResendAccountConfirmation/useResendAccountConfirmation.test.ts +++ b/composables/api/useResendAccountConfirmation/useResendAccountConfirmation.test.ts @@ -1,5 +1,3 @@ -import { afterEach, describe, expect, it, vi } from 'vitest' - const mockSuccessLogin = vi.fn(() => Promise.resolve({ data: { token: 'token' }, ok: true }), ) diff --git a/composables/api/useValidateRecoveryToken/useValidateRecoveryToken.test.ts b/composables/api/useValidateRecoveryToken/useValidateRecoveryToken.test.ts index 94816859..f7312ea2 100644 --- a/composables/api/useValidateRecoveryToken/useValidateRecoveryToken.test.ts +++ b/composables/api/useValidateRecoveryToken/useValidateRecoveryToken.test.ts @@ -1,5 +1,3 @@ -import { describe, expect, it, vi } from 'vitest' - const mockSuccessRecoverDetail = vi.fn(() => Promise.resolve({ ok: true })) describe('useValidateRecoveryToken', () => { diff --git a/composables/useApi/useApi.test.ts b/composables/useApi/useApi.test.ts index cc8cf3ba..65e91670 100644 --- a/composables/useApi/useApi.test.ts +++ b/composables/useApi/useApi.test.ts @@ -1,4 +1,3 @@ -import { describe, expect, it, vi } from 'vitest' import { ref } from 'vue' import type { ProblemDetails } from 'lib/api/data-contracts' import type { HttpResponse } from 'lib/api/http-client' diff --git a/pages/confirm-account.test.ts b/pages/confirm-account.test.ts index e9a3c934..0131ca1b 100644 --- a/pages/confirm-account.test.ts +++ b/pages/confirm-account.test.ts @@ -1,5 +1,3 @@ -import { vi, describe, it, expect } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import { getByClass } from 'root/testUtils' import confirmAccount from 'pages/confirm-account.vue' diff --git a/pages/index.test.ts b/pages/index.test.ts index 805789d0..8e36d482 100644 --- a/pages/index.test.ts +++ b/pages/index.test.ts @@ -1,5 +1,3 @@ -import { describe, it, expect } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import index from 'pages/index.vue' diff --git a/pages/reset-password.test.ts b/pages/reset-password.test.ts index 2e63b844..0fda2497 100644 --- a/pages/reset-password.test.ts +++ b/pages/reset-password.test.ts @@ -1,5 +1,3 @@ -import { vi, describe, it, expect } from 'vitest' - import { mountSuspended } from '@nuxt/test-utils/runtime' import { getByClass } from 'root/testUtils' import resetPassword from 'pages/reset-password.vue' diff --git a/tsconfig.json b/tsconfig.json index ebd38700..25f9a60f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,7 +17,8 @@ // Other "jsx": "preserve", - "lib": ["ESNext", "DOM"] + "lib": ["ESNext", "DOM"], + "types": ["vitest/globals"] }, // https://v3.nuxtjs.org/concepts/typescript "extends": "./.nuxt/tsconfig.json" diff --git a/vitest.config.ts b/vitest.config.ts index e0d45a09..1675a4da 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -6,6 +6,7 @@ import { defineVitestConfig } from '@nuxt/test-utils/config' export default defineVitestConfig({ test: { environment: 'nuxt', + globals: true, sequence: { shuffle: true, },