Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add vitest for unit testing #13

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"ms-playwright.playwright",
"nuxt.mdc",
"stylelint.vscode-stylelint",
"vitest.explorer",
"vue.volar",
"vue.vscode-typescript-vue-plugin"
]
Expand Down
2 changes: 1 addition & 1 deletion components/ui/centered.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="grid absolute inset-0 size-full place-content-center place-items-center">
<div class="absolute inset-0 grid size-full place-content-center place-items-center">
<slot />
</div>
</template>
9 changes: 8 additions & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ export default defineNuxtConfig({
imports: {
dirs: ["./config/"],
},
modules: ["@nuxt/content", "@nuxt/image", "@nuxtjs/color-mode", "@nuxtjs/i18n", "@vueuse/nuxt"],
modules: [
"@nuxt/content",
"@nuxt/image",
"@nuxt/test-utils/module",
"@nuxtjs/color-mode",
"@nuxtjs/i18n",
"@vueuse/nuxt",
],
nitro: {
compressPublicAssets: true,
prerender: {
Expand Down
28 changes: 24 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
"prepare": "run-s setup",
"setup": "is-ci || simple-git-hooks",
"start": "nuxt preview --dotenv ./.env.local",
"test": "exit 0",
"test:e2e": "playwright test",
"test:e2e:codegen": "playwright codegen",
"test:e2e:ui": "playwright test --ui",
"test": "vitest run",
"test:e2e": "dotenv -c -- playwright test",
"test:e2e:codegen": "dotenv -c -- playwright codegen",
"test:e2e:ui": "dotenv -c -- playwright test --ui",
"types:check": "nuxt typecheck",
"validate": "run-p format:check lint:check types:check test test:e2e"
},
Expand Down Expand Up @@ -58,17 +58,25 @@
"@acdh-oeaw/stylelint-config": "^2.0.1",
"@acdh-oeaw/tailwindcss-preset": "^0.0.22",
"@acdh-oeaw/tsconfig": "^1.0.2",
"@axe-core/playwright": "^4.8.2",
"@nuxt/devtools": "^1.0.8",
"@nuxt/test-utils": "^3.9.0",
"@playwright/test": "^1.41.2",
"@testing-library/user-event": "^14.5.1",
"@testing-library/vue": "^7.0.0",
"@types/node": "^20.11.19",
"@vue/test-utils": "^2.4.3",
"axe-core": "^4.8.4",
"axe-playwright": "^2.0.1",
"ci-info": "^4.0.0",
"dotenv": "^16.4.5",
"dotenv-expand": "^11.0.6",
"eslint": "^8.56.0",
"eslint-plugin-tailwindcss": "^3.14.3",
"eslint-plugin-testing-library": "^6.1.0",
"eslint-plugin-vitest": "^0.3.2",
"is-ci": "^3.0.1",
"jsdom": "^22.1.0",
"lint-staged": "^15.2.2",
"npm-run-all2": "^6.1.2",
"nuxt": "^3.10.2",
Expand All @@ -79,6 +87,7 @@
"stylelint": "^16.2.1",
"tailwindcss": "^3.4.1",
"typescript": "^5.3.3",
"vitest": "^1.1.0",
"vue-tsc": "^1.8.27"
},
"browserslist": {
Expand All @@ -100,6 +109,17 @@
"@acdh-oeaw/eslint-config-vue",
"@acdh-oeaw/eslint-config-nuxt",
"plugin:eslint-plugin-tailwindcss/recommended"
],
"overrides": [
{
"files": [
"./test/**/*.@(spec|test).ts"
],
"extends": [
"plugin:eslint-plugin-testing-library/vue",
"plugin:eslint-plugin-vitest/recommended"
]
}
]
},
"lint-staged": {
Expand Down
Loading