diff --git a/nuxt.config.ts b/nuxt.config.ts
index a0d0772..3eb1109 100644
--- a/nuxt.config.ts
+++ b/nuxt.config.ts
@@ -11,6 +11,11 @@ export default defineNuxtConfig({
'@nuxt/test-utils/module',
],
devtools: { enabled: true },
+ app: {
+ head: {
+ htmlAttrs: { lang: 'en' },
+ },
+ },
future: {
compatibilityVersion: 4,
},
@@ -23,4 +28,8 @@ export default defineNuxtConfig({
stylistic: true,
},
},
+ // Ensure that any HTML validation errors are treated as build errors
+ htmlValidator: {
+ failOnError: true,
+ },
})
diff --git a/package.json b/package.json
index 3085903..16208b7 100644
--- a/package.json
+++ b/package.json
@@ -1,13 +1,24 @@
{
"name": "nuxt-app",
+ "license": "MIT",
"private": true,
"type": "module",
+ "author": {
+ "name": "Daniel Roe",
+ "email": "daniel@roe.dev",
+ "url": "https://roe.dev"
+ },
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
- "postinstall": "nuxt prepare && simple-git-hooks"
+ "postinstall": "nuxt prepare && simple-git-hooks",
+ "test:types": "vue-tsc --noEmit",
+ "test:unit": "vitest",
+ "test:runtime": "vitest -c vitest.nuxt.config.ts",
+ "test:browser": "playwright test test/browser",
+ "test:browser:update": "docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.48.0-focal bash -c 'corepack enable && pnpm i && pnpm playwright test test/browser --update-snapshots'"
},
"dependencies": {
"@nuxt/eslint": "^0.6.0",
diff --git a/renovate.json b/renovate.json
new file mode 100644
index 0000000..f9fa65a
--- /dev/null
+++ b/renovate.json
@@ -0,0 +1,7 @@
+{
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
+ "prCreation": "immediate",
+ "extends": [
+ "github>danielroe/renovate"
+ ]
+}
diff --git a/test/browser/index.test.ts b/test/browser/index.test.ts
new file mode 100644
index 0000000..4753c0a
--- /dev/null
+++ b/test/browser/index.test.ts
@@ -0,0 +1,11 @@
+import { expect, test } from '@nuxt/test-utils/playwright'
+
+test('home page', async ({ page }) => {
+ await page.goto('/')
+ await expect(page).toHaveScreenshot()
+})
+
+test('og image for home page', async ({ page }) => {
+ await page.goto('/__og-image__/image/og.png')
+ await expect(page).toHaveScreenshot()
+})
diff --git a/test/nuxt/index.test.ts b/test/nuxt/index.test.ts
new file mode 100644
index 0000000..5a7d7cc
--- /dev/null
+++ b/test/nuxt/index.test.ts
@@ -0,0 +1,14 @@
+import { describe, expect, it } from 'vitest'
+
+describe('runtime environment', () => {
+ it('should work', () => {
+ expect(useRuntimeConfig().app).toMatchInlineSnapshot(`
+ {
+ "baseURL": "/",
+ "buildAssetsDir": "/_nuxt/",
+ "buildId": "test",
+ "cdnURL": "",
+ }
+ `)
+ })
+})
diff --git a/test/unit/index.test.ts b/test/unit/index.test.ts
new file mode 100644
index 0000000..3577ca8
--- /dev/null
+++ b/test/unit/index.test.ts
@@ -0,0 +1,7 @@
+import { describe, expect, it } from 'vitest'
+
+describe('work', () => {
+ it('should ', () => {
+ expect(true).toBe(true)
+ })
+})
diff --git a/vitest.config.ts b/vitest.config.ts
new file mode 100644
index 0000000..1d2a4fe
--- /dev/null
+++ b/vitest.config.ts
@@ -0,0 +1,12 @@
+import { defineConfig, defaultExclude } from 'vitest/config'
+
+export default defineConfig({
+ //
+ test: {
+ exclude: [
+ ...defaultExclude,
+ 'test/browser/**',
+ 'test/nuxt/**',
+ ],
+ },
+})
diff --git a/vitest.nuxt.config.ts b/vitest.nuxt.config.ts
new file mode 100644
index 0000000..fb355c9
--- /dev/null
+++ b/vitest.nuxt.config.ts
@@ -0,0 +1,8 @@
+import { defineVitestConfig } from '@nuxt/test-utils/config'
+
+export default defineVitestConfig({
+ test: {
+ dir: './test/nuxt',
+ environment: 'nuxt',
+ },
+})