diff --git a/package.json b/package.json index 804e38e..95e104b 100644 --- a/package.json +++ b/package.json @@ -31,8 +31,7 @@ "preview": "nuxt preview", "analyze": "nuxi analyze", "postinstall": "nuxt prepare", - "test": "nuxi test", - "test:watch": "nuxi test --dev --watch", + "test": "vitest", "lint": "eslint .", "lint:fix": "eslint . --fix" }, @@ -54,8 +53,8 @@ "@vercel/analytics": "^1.3.1", "cloudflare": "^3.2.0", "eslint": "^9.4.0", + "happy-dom": "^14.12.0", "nuxt": "^3.11.2", - "playwright": "^1.44.1", "radash": "^12.1.0", "release-it": "^17.3.0", "sass": "1.77.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7714ceb..477a2f3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -24,7 +24,7 @@ devDependencies: version: 1.7.0 '@nuxt/test-utils': specifier: ^3.13.1 - version: 3.13.1(h3@1.11.1)(nitropack@2.9.6)(vite@5.2.12)(vitest@1.6.0)(vue-router@4.3.2)(vue@3.4.27) + version: 3.13.1(h3@1.11.1)(happy-dom@14.12.0)(nitropack@2.9.6)(vite@5.2.12)(vitest@1.6.0)(vue-router@4.3.2)(vue@3.4.27) '@nuxtjs/google-fonts': specifier: ^3.2.0 version: 3.2.0 @@ -52,12 +52,12 @@ devDependencies: eslint: specifier: ^9.4.0 version: 9.4.0 + happy-dom: + specifier: ^14.12.0 + version: 14.12.0 nuxt: specifier: ^3.11.2 version: 3.11.2(@opentelemetry/api@1.8.0)(@types/node@20.13.0)(@unocss/reset@0.60.4)(eslint@9.4.0)(floating-vue@5.2.2)(sass@1.77.4)(typescript@5.4.5)(unocss@0.60.4)(vite@5.2.12) - playwright: - specifier: ^1.44.1 - version: 1.44.1 radash: specifier: ^12.1.0 version: 12.1.0 @@ -72,7 +72,7 @@ devDependencies: version: 5.4.5 vitest: specifier: ^1.6.0 - version: 1.6.0(@types/node@20.13.0)(sass@1.77.4) + version: 1.6.0(@types/node@20.13.0)(happy-dom@14.12.0)(sass@1.77.4) packages: @@ -1367,7 +1367,7 @@ packages: - supports-color dev: true - /@nuxt/test-utils@3.13.1(h3@1.11.1)(nitropack@2.9.6)(vite@5.2.12)(vitest@1.6.0)(vue-router@4.3.2)(vue@3.4.27): + /@nuxt/test-utils@3.13.1(h3@1.11.1)(happy-dom@14.12.0)(nitropack@2.9.6)(vite@5.2.12)(vitest@1.6.0)(vue-router@4.3.2)(vue@3.4.27): resolution: {integrity: sha512-rqNnjArhFUU8qMHtpEZzjfF6fGTzeXxZsreNLUy9X5AoUuS37HgnobNJIirTrA0xzlzitKVm/mB9r4gXZGzWdQ==} engines: {node: '>=18.20.2'} peerDependencies: @@ -1419,6 +1419,7 @@ packages: fake-indexeddb: 5.0.2 get-port-please: 3.1.2 h3: 1.11.1 + happy-dom: 14.12.0 local-pkg: 0.5.0 magic-string: 0.30.10 nitropack: 2.9.6(@opentelemetry/api@1.8.0) @@ -1433,8 +1434,8 @@ packages: unenv: 1.9.0 unplugin: 1.10.1 vite: 5.2.12(@types/node@20.13.0)(sass@1.77.4) - vitest: 1.6.0(@types/node@20.13.0)(sass@1.77.4) - vitest-environment-nuxt: 1.0.0(h3@1.11.1)(nitropack@2.9.6)(vite@5.2.12)(vitest@1.6.0)(vue-router@4.3.2)(vue@3.4.27) + vitest: 1.6.0(@types/node@20.13.0)(happy-dom@14.12.0)(sass@1.77.4) + vitest-environment-nuxt: 1.0.0(h3@1.11.1)(happy-dom@14.12.0)(nitropack@2.9.6)(vite@5.2.12)(vitest@1.6.0)(vue-router@4.3.2)(vue@3.4.27) vue: 3.4.27(typescript@5.4.5) vue-router: 4.3.2(vue@3.4.27) transitivePeerDependencies: @@ -5545,7 +5546,7 @@ packages: '@typescript-eslint/eslint-plugin': 7.11.0(@typescript-eslint/parser@7.11.0)(eslint@9.4.0)(typescript@5.4.5) '@typescript-eslint/utils': 7.11.0(eslint@9.4.0)(typescript@5.4.5) eslint: 9.4.0 - vitest: 1.6.0(@types/node@20.13.0)(sass@1.77.4) + vitest: 1.6.0(@types/node@20.13.0)(happy-dom@14.12.0)(sass@1.77.4) transitivePeerDependencies: - supports-color - typescript @@ -6041,14 +6042,6 @@ packages: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} dev: true - /fsevents@2.3.2: - resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} - engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} - os: [darwin] - requiresBuild: true - dev: true - optional: true - /fsevents@2.3.3: resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} @@ -6439,6 +6432,15 @@ packages: uglify-js: 3.17.4 dev: true + /happy-dom@14.12.0: + resolution: {integrity: sha512-dHcnlGFY2o2CdxfuYpqwSrBrpj/Kuzv4u4f3TU5yHW1GL24dKij4pv1BRjXnXc3uWo8qsCbToF9weaDsm/He8A==} + engines: {node: '>=16.0.0'} + dependencies: + entities: 4.5.0 + webidl-conversions: 7.0.0 + whatwg-mimetype: 3.0.0 + dev: true + /has-bigints@1.0.2: resolution: {integrity: sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==} dev: true @@ -8733,22 +8735,6 @@ packages: mlly: 1.7.0 pathe: 1.1.2 - /playwright-core@1.44.1: - resolution: {integrity: sha512-wh0JWtYTrhv1+OSsLPgFzGzt67Y7BE/ZS3jEqgGBlp2ppp1ZDj8c+9IARNW4dwf1poq5MgHreEM2KV/GuR4cFA==} - engines: {node: '>=16'} - hasBin: true - dev: true - - /playwright@1.44.1: - resolution: {integrity: sha512-qr/0UJ5CFAtloI3avF95Y0L1xQo6r3LQArLIg/z/PoGJ6xa+EwzrwO5lpNr/09STxdHuUoP2mvuELJS+hLdtgg==} - engines: {node: '>=16'} - hasBin: true - dependencies: - playwright-core: 1.44.1 - optionalDependencies: - fsevents: 2.3.2 - dev: true - /pluralize@8.0.0: resolution: {integrity: sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==} engines: {node: '>=4'} @@ -11082,10 +11068,10 @@ packages: fsevents: 2.3.3 dev: true - /vitest-environment-nuxt@1.0.0(h3@1.11.1)(nitropack@2.9.6)(vite@5.2.12)(vitest@1.6.0)(vue-router@4.3.2)(vue@3.4.27): + /vitest-environment-nuxt@1.0.0(h3@1.11.1)(happy-dom@14.12.0)(nitropack@2.9.6)(vite@5.2.12)(vitest@1.6.0)(vue-router@4.3.2)(vue@3.4.27): resolution: {integrity: sha512-AWMO9h4HdbaFdPWZw34gALFI8gbBiOpvfbyeZwHIPfh4kWg/TwElYHvYMQ61WPUlCGaS5LebfHkaI0WPyb//Iw==} dependencies: - '@nuxt/test-utils': 3.13.1(h3@1.11.1)(nitropack@2.9.6)(vite@5.2.12)(vitest@1.6.0)(vue-router@4.3.2)(vue@3.4.27) + '@nuxt/test-utils': 3.13.1(h3@1.11.1)(happy-dom@14.12.0)(nitropack@2.9.6)(vite@5.2.12)(vitest@1.6.0)(vue-router@4.3.2)(vue@3.4.27) transitivePeerDependencies: - '@cucumber/cucumber' - '@jest/globals' @@ -11106,7 +11092,7 @@ packages: - vue-router dev: true - /vitest@1.6.0(@types/node@20.13.0)(sass@1.77.4): + /vitest@1.6.0(@types/node@20.13.0)(happy-dom@14.12.0)(sass@1.77.4): resolution: {integrity: sha512-H5r/dN06swuFnzNFhq/dnz37bPXnq8xB2xB5JOVk8K09rUtoeNN+LHWkoQ0A/i3hvbUKKcCei9KpbxqHMLhLLA==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true @@ -11141,6 +11127,7 @@ packages: chai: 4.4.1 debug: 4.3.5 execa: 8.0.1 + happy-dom: 14.12.0 local-pkg: 0.5.0 magic-string: 0.30.10 pathe: 1.1.2 @@ -11329,6 +11316,11 @@ packages: resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} dev: true + /webidl-conversions@7.0.0: + resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==} + engines: {node: '>=12'} + dev: true + /webpack-sources@3.2.3: resolution: {integrity: sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==} engines: {node: '>=10.13.0'} @@ -11376,6 +11368,11 @@ packages: - uglify-js dev: true + /whatwg-mimetype@3.0.0: + resolution: {integrity: sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==} + engines: {node: '>=12'} + dev: true + /whatwg-url@5.0.0: resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} dependencies: diff --git a/tests/base.test.ts b/test/base.spec.ts similarity index 83% rename from tests/base.test.ts rename to test/base.spec.ts index 7b5ad66..849c856 100644 --- a/tests/base.test.ts +++ b/test/base.spec.ts @@ -1,7 +1,9 @@ import { describe, expect, it } from 'vitest' -import { $fetch, fetch, isDev } from '@nuxt/test-utils' +import { $fetch, fetch, isDev, setup } from '@nuxt/test-utils/e2e' + +describe('base', async () => { + await setup() -describe('base', () => { it('index page is callable', async () => { const doc = await $fetch('/') expect(doc).toContain('DOCTYPE') diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 0000000..6410ffd --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,7 @@ +import { defineVitestConfig } from '@nuxt/test-utils/config' + +export default defineVitestConfig({ + test: { + environment: 'nuxt', + }, +})