From 65c5a67f69db14ee8c04cb839261fc5f088f8d62 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 21 Nov 2023 09:17:45 +0000 Subject: [PATCH 01/15] feat: migrate code to internal nuxt-vitest (wip) --- examples/app/package.json | 3 +- examples/app/vitest.config.ts | 2 +- package.json | 4 +- pnpm-lock.yaml | 279 +++++++----------- src/config.ts | 2 +- src/nuxt-vitest/config.ts | 4 +- src/nuxt-vitest/module.ts | 2 +- src/runtime-utils.ts | 2 +- src/vitest-environment-nuxt/runtime/mock.ts | 6 +- src/vitest-environment-nuxt/runtime/render.ts | 4 +- src/vitest-environment.ts | 2 +- test/fixtures/nuxt-vitest/nuxt.config.ts | 15 +- test/fixtures/nuxt-vitest/package.json | 5 +- test/fixtures/nuxt-vitest/vitest.config.ts | 2 +- 14 files changed, 128 insertions(+), 204 deletions(-) diff --git a/examples/app/package.json b/examples/app/package.json index 79a046993..019807283 100644 --- a/examples/app/package.json +++ b/examples/app/package.json @@ -17,7 +17,6 @@ }, "devDependencies": { "@nuxt/test-utils": "latest", - "happy-dom": "^12.10.3", - "nuxt-vitest": "^0.11.5" + "happy-dom": "^12.10.3" } } diff --git a/examples/app/vitest.config.ts b/examples/app/vitest.config.ts index 840a6dde5..4e658e956 100644 --- a/examples/app/vitest.config.ts +++ b/examples/app/vitest.config.ts @@ -1,4 +1,4 @@ -import { defineVitestConfig } from 'nuxt-vitest/config' +import { defineVitestConfig } from '@nuxt/test-utils/config' export default defineVitestConfig({ // any custom vitest config you require diff --git a/package.json b/package.json index e1a2bf867..d6cc369db 100644 --- a/package.json +++ b/package.json @@ -45,15 +45,13 @@ "local-pkg": "^0.5.0", "magic-string": "^0.30.5", "node-fetch-native": "^1.4.1", - "nuxt-vitest": "^0.11.5", "ofetch": "^1.3.3", "pathe": "^1.1.1", "perfect-debounce": "^1.0.0", "radix3": "^1.1.0", "std-env": "^3.5.0", "ufo": "^1.3.2", - "unenv": "^1.7.4", - "vitest-environment-nuxt": "^0.11.5" + "unenv": "^1.7.4" }, "devDependencies": { "@jest/globals": "29.7.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4f6d021c8..20e15532a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -50,9 +50,6 @@ importers: node-fetch-native: specifier: ^1.4.1 version: 1.4.1 - nuxt-vitest: - specifier: ^0.11.5 - version: 0.11.5(@testing-library/vue@7.0.0)(@vitejs/plugin-vue-jsx@3.1.0)(@vitejs/plugin-vue@4.5.0)(happy-dom@12.10.3)(jsdom@22.1.0)(rollup@4.5.0)(vite@5.0.0)(vitest@0.33.0)(vue-router@4.2.5)(vue@3.3.8) ofetch: specifier: ^1.3.3 version: 1.3.3 @@ -74,9 +71,6 @@ importers: unenv: specifier: ^1.7.4 version: 1.7.4 - vitest-environment-nuxt: - specifier: ^0.11.5 - version: 0.11.5(@testing-library/vue@7.0.0)(happy-dom@12.10.3)(jsdom@22.1.0)(rollup@4.5.0)(vitest@0.33.0)(vue-router@4.2.5)(vue@3.3.8) vue: specifier: ^3.3.4 version: 3.3.8(typescript@5.2.2) @@ -163,9 +157,6 @@ importers: happy-dom: specifier: ^12.10.3 version: 12.10.3 - nuxt-vitest: - specifier: ^0.11.5 - version: 0.11.5(@testing-library/vue@7.0.0)(@vitejs/plugin-vue-jsx@3.1.0)(@vitejs/plugin-vue@4.5.0)(happy-dom@12.10.3)(jsdom@22.1.0)(rollup@4.5.0)(vite@4.5.0)(vitest@0.33.0)(vue-router@4.2.5)(vue@3.3.8) examples/app-jest: dependencies: @@ -267,6 +258,7 @@ packages: dependencies: '@babel/highlight': 7.23.4 chalk: 2.4.2 + dev: true /@babel/code-frame@7.23.4: resolution: {integrity: sha512-r1IONyb6Ia+jYR2vvIDhdWdlTGhqbBoFqLTQidzZ4kepUFH15ejXvFHxCVbtl7BOXIudsIubf4E81xeA3h3IXA==} @@ -322,6 +314,7 @@ packages: semver: 6.3.1 transitivePeerDependencies: - supports-color + dev: true /@babel/generator@7.23.0: resolution: {integrity: sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==} @@ -390,6 +383,7 @@ packages: '@babel/helper-skip-transparent-expression-wrappers': 7.22.5 '@babel/helper-split-export-declaration': 7.22.6 semver: 6.3.1 + dev: true /@babel/helper-environment-visitor@7.22.20: resolution: {integrity: sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==} @@ -445,6 +439,7 @@ packages: '@babel/helper-simple-access': 7.22.5 '@babel/helper-split-export-declaration': 7.22.6 '@babel/helper-validator-identifier': 7.22.20 + dev: true /@babel/helper-optimise-call-expression@7.22.5: resolution: {integrity: sha512-HBwaojN0xFRx4yIvpwGqxiV2tUfl7401jlok564NgB9EHS1y6QT17FmKWm4ztqjeVdXLuC4fSvHc5ePpQjoTbw==} @@ -477,6 +472,7 @@ packages: '@babel/helper-environment-visitor': 7.22.20 '@babel/helper-member-expression-to-functions': 7.23.0 '@babel/helper-optimise-call-expression': 7.22.5 + dev: true /@babel/helper-simple-access@7.22.5: resolution: {integrity: sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==} @@ -636,6 +632,7 @@ packages: dependencies: '@babel/core': 7.23.3 '@babel/helper-plugin-utils': 7.22.5 + dev: true /@babel/plugin-syntax-logical-assignment-operators@7.10.4(@babel/core@7.23.2): resolution: {integrity: sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==} @@ -718,6 +715,7 @@ packages: dependencies: '@babel/core': 7.23.3 '@babel/helper-plugin-utils': 7.22.5 + dev: true /@babel/plugin-transform-typescript@7.22.15(@babel/core@7.23.2): resolution: {integrity: sha512-1uirS0TnijxvQLnlv5wQBwOX3E1wCFX7ITv+9pBV2wKEk4K+M5tqDaoNXnTH8tjEIYHLO98MwiTWO04Ggz4XuA==} @@ -742,12 +740,14 @@ packages: '@babel/helper-create-class-features-plugin': 7.22.15(@babel/core@7.23.3) '@babel/helper-plugin-utils': 7.22.5 '@babel/plugin-syntax-typescript': 7.23.3(@babel/core@7.23.3) + dev: true /@babel/runtime@7.23.2: resolution: {integrity: sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg==} engines: {node: '>=6.9.0'} dependencies: regenerator-runtime: 0.14.0 + dev: true /@babel/standalone@7.23.2: resolution: {integrity: sha512-VJNw7OS26JvB6rE9XpbT6uQeQIEBWU5eeHGS4VR/+/4ZoKdLBXLcy66ZVJ/9IBkK1RMp8B0cohvhzdKWtJAGmg==} @@ -1420,6 +1420,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@sinclair/typebox': 0.27.8 + dev: true /@jest/source-map@29.6.3: resolution: {integrity: sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==} @@ -2191,6 +2192,7 @@ packages: /@one-ini/wasm@0.1.1: resolution: {integrity: sha512-XuySG1E38YScSJoMlqovLru4KTUNSjgVTIjyh7qMX6aNN5HY5Ct5LhRJdxO79JtTzKfzV/bnWpz+zquYrISsvw==} + dev: true /@parcel/watcher-android-arm64@2.3.0: resolution: {integrity: sha512-f4o9eA3dgk0XRT3XhB0UWpWpLnKgrh1IwNJKJ7UJek7eTYccQ8LR7XUWFKqw6aEq5KUNlCcGvSzKqSX/vtWVVA==} @@ -2607,6 +2609,7 @@ packages: /@sinclair/typebox@0.27.8: resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} + dev: true /@sinonjs/commons@3.0.0: resolution: {integrity: sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==} @@ -2632,6 +2635,7 @@ packages: dom-accessibility-api: 0.5.16 lz-string: 1.5.0 pretty-format: 27.5.1 + dev: true /@testing-library/vue@7.0.0(@vue/compiler-sfc@3.3.8)(vue@3.3.8): resolution: {integrity: sha512-JU/q93HGo2qdm1dCgWymkeQlfpC0/0/DBZ2nAHgEAsVZxX11xVIxT7gbXdI7HACQpUbsUWt1zABGU075Fzt9XQ==} @@ -2647,6 +2651,7 @@ packages: vue: 3.3.8(typescript@5.2.2) transitivePeerDependencies: - '@vue/server-renderer' + dev: true /@tootallnate/once@2.0.0: resolution: {integrity: sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==} @@ -2685,6 +2690,7 @@ packages: /@types/aria-query@5.0.2: resolution: {integrity: sha512-PHKZuMN+K5qgKIWhBodXzQslTo5P+K/6LqeKXS6O/4liIDdZqaX5RXrCK++LAw+y/nptN48YmUMFiQHRSWYwtQ==} + dev: true /@types/babel__core@7.20.3: resolution: {integrity: sha512-54fjTSeSHwfan8AyHWrKbfBWiEUrNTZsUwPTDSNaaP1QDQIZbeNUg3a59E9D+375MzUw/x1vx2/0F5LBz+AeYA==} @@ -2719,9 +2725,11 @@ packages: resolution: {integrity: sha512-CCWNXrJYSUIojZ1149ksLl3AN9cmZ5djf+yUoVVV+NuYrtydItQVlL2ZDqyC6M6O9LWRnVf8yYDxbXHO2TfQZg==} dependencies: '@types/chai': 4.3.9 + dev: true /@types/chai@4.3.9: resolution: {integrity: sha512-69TtiDzu0bcmKQv3yg1Zx409/Kd7r0b5F1PfpYJfSHzLGtB53547V4u+9iqKYsTu/O2ai6KTb0TInNpvuQ3qmg==} + dev: true /@types/estree@1.0.5: resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} @@ -3001,22 +3009,6 @@ packages: transitivePeerDependencies: - supports-color - /@vitejs/plugin-vue-jsx@3.1.0(vite@4.5.0)(vue@3.3.8): - resolution: {integrity: sha512-w9M6F3LSEU5kszVb9An2/MmXNxocAnUb3WhRr8bHlimhDrXNt6n6D2nJQR3UXpGlZHh/EsgouOHCsM8V3Ln+WA==} - engines: {node: ^14.18.0 || >=16.0.0} - peerDependencies: - vite: ^4.0.0 || ^5.0.0 - vue: ^3.0.0 - dependencies: - '@babel/core': 7.23.3 - '@babel/plugin-transform-typescript': 7.23.4(@babel/core@7.23.3) - '@vue/babel-plugin-jsx': 1.1.5(@babel/core@7.23.3) - vite: 4.5.0(@types/node@20.8.10) - vue: 3.3.8(typescript@5.2.2) - transitivePeerDependencies: - - supports-color - dev: true - /@vitejs/plugin-vue-jsx@3.1.0(vite@5.0.0)(vue@3.3.8): resolution: {integrity: sha512-w9M6F3LSEU5kszVb9An2/MmXNxocAnUb3WhRr8bHlimhDrXNt6n6D2nJQR3UXpGlZHh/EsgouOHCsM8V3Ln+WA==} engines: {node: ^14.18.0 || >=16.0.0} @@ -3031,6 +3023,7 @@ packages: vue: 3.3.8(typescript@5.2.2) transitivePeerDependencies: - supports-color + dev: true /@vitejs/plugin-vue@4.4.0(vite@4.5.0)(vue@3.3.8): resolution: {integrity: sha512-xdguqb+VUwiRpSg+nsc2HtbAUSGak25DXYvpQQi4RVU1Xq1uworyoH/md9Rfd8zMmPR/pSghr309QNcftUVseg==} @@ -3042,17 +3035,6 @@ packages: vite: 4.5.0(@types/node@20.8.10) vue: 3.3.8(typescript@5.2.2) - /@vitejs/plugin-vue@4.5.0(vite@4.5.0)(vue@3.3.8): - resolution: {integrity: sha512-a2WSpP8X8HTEww/U00bU4mX1QpLINNuz/2KMNpLsdu3BzOpak3AGI1CJYBTXcc4SPhaD0eNRUp7IyQK405L5dQ==} - engines: {node: ^14.18.0 || >=16.0.0} - peerDependencies: - vite: ^4.0.0 || ^5.0.0 - vue: ^3.2.25 - dependencies: - vite: 4.5.0(@types/node@20.8.10) - vue: 3.3.8(typescript@5.2.2) - dev: true - /@vitejs/plugin-vue@4.5.0(vite@5.0.0)(vue@3.3.8): resolution: {integrity: sha512-a2WSpP8X8HTEww/U00bU4mX1QpLINNuz/2KMNpLsdu3BzOpak3AGI1CJYBTXcc4SPhaD0eNRUp7IyQK405L5dQ==} engines: {node: ^14.18.0 || >=16.0.0} @@ -3062,6 +3044,7 @@ packages: dependencies: vite: 5.0.0 vue: 3.3.8(typescript@5.2.2) + dev: true /@vitest/expect@0.33.0: resolution: {integrity: sha512-sVNf+Gla3mhTCxNJx+wJLDPp/WcstOe0Ksqz4Vec51MmgMth/ia0MGFEkIZmVGeTL5HtjYR4Wl/ZxBxBXZJTzQ==} @@ -3069,6 +3052,7 @@ packages: '@vitest/spy': 0.33.0 '@vitest/utils': 0.33.0 chai: 4.3.10 + dev: true /@vitest/runner@0.33.0: resolution: {integrity: sha512-UPfACnmCB6HKRHTlcgCoBh6ppl6fDn+J/xR8dTufWiKt/74Y9bHci5CKB8tESSV82zKYtkBJo9whU3mNvfaisg==} @@ -3076,6 +3060,7 @@ packages: '@vitest/utils': 0.33.0 p-limit: 4.0.0 pathe: 1.1.1 + dev: true /@vitest/snapshot@0.33.0: resolution: {integrity: sha512-tJjrl//qAHbyHajpFvr8Wsk8DIOODEebTu7pgBrP07iOepR5jYkLFiqLq2Ltxv+r0uptUb4izv1J8XBOwKkVYA==} @@ -3083,25 +3068,13 @@ packages: magic-string: 0.30.5 pathe: 1.1.1 pretty-format: 29.7.0 + dev: true /@vitest/spy@0.33.0: resolution: {integrity: sha512-Kv+yZ4hnH1WdiAkPUQTpRxW8kGtH8VRTnus7ZTGovFYM1ZezJpvGtb9nPIjPnptHbsyIAxYZsEpVPYgtpjGnrg==} dependencies: tinyspy: 2.2.0 - - /@vitest/ui@0.33.0(vitest@0.33.0): - resolution: {integrity: sha512-7gbAjLqt30R4bodkJAutdpy4ncv+u5IKTHYTow1c2q+FOxZUC9cKOSqMUxjwaaTwLN+EnDnmXYPtg3CoahaUzQ==} - peerDependencies: - vitest: '>=0.30.1 <1' - dependencies: - '@vitest/utils': 0.33.0 - fast-glob: 3.3.2 - fflate: 0.8.1 - flatted: 3.2.9 - pathe: 1.1.1 - picocolors: 1.0.0 - sirv: 2.0.3 - vitest: 0.33.0(happy-dom@12.10.3)(jsdom@22.1.0) + dev: true /@vitest/utils@0.33.0: resolution: {integrity: sha512-pF1w22ic965sv+EN6uoePkAOTkAPWM03Ri/jXNyMIKBb/XHLDPfhLvf/Fa9g0YECevAIz56oVYXhodLvLQ/awA==} @@ -3109,6 +3082,7 @@ packages: diff-sequences: 29.6.3 loupe: 2.3.7 pretty-format: 29.7.0 + dev: true /@vue-macros/common@1.8.0(rollup@3.29.4)(vue@3.3.8): resolution: {integrity: sha512-auDJJzE0z3uRe3867e0DsqcseKImktNf5ojCZgUKqiVxb2yTlwlgOVAYCgoep9oITqxkXQymSvFeKhedi8PhaA==} @@ -3187,6 +3161,7 @@ packages: svg-tags: 1.0.0 transitivePeerDependencies: - supports-color + dev: true /@vue/compiler-core@3.3.8: resolution: {integrity: sha512-hN/NNBUECw8SusQvDSqqcVv6gWq8L6iAktUR0UF3vGu2OhzRqcOiAno0FmBJWwxhYEXRlQJT5XnoKsVq1WZx4g==} @@ -3264,19 +3239,6 @@ packages: /@vue/shared@3.3.8: resolution: {integrity: sha512-8PGwybFwM4x8pcfgqEQFy70NaQxASvOC5DJwLQfpArw1UDfUXrJkdxD3BhVTMS+0Lef/TU7YO0Jvr0jJY8T+mw==} - /@vue/test-utils@2.4.1(vue@3.3.8): - resolution: {integrity: sha512-VO8nragneNzUZUah6kOjiFmD/gwRjUauG9DROh6oaOeFwX1cZRUNHhdeogE8635cISigXFTtGLUQWx5KCb0xeg==} - peerDependencies: - '@vue/server-renderer': ^3.0.1 - vue: ^3.0.1 - peerDependenciesMeta: - '@vue/server-renderer': - optional: true - dependencies: - js-beautify: 1.14.9 - vue: 3.3.8(typescript@5.2.2) - vue-component-type-helpers: 1.8.4 - /@vue/test-utils@2.4.2(vue@3.3.8): resolution: {integrity: sha512-07lLjpG1o9tEBoWQfVOFhDT7+WFCdDeECoeSdzOuVgIi6nxb2JDLGNNOV6+3crPpyg/jMlIocj96UROcgomiGg==} peerDependencies: @@ -3289,6 +3251,7 @@ packages: js-beautify: 1.14.9 vue: 3.3.8(typescript@5.2.2) vue-component-type-helpers: 1.8.22 + dev: true /abab@2.0.6: resolution: {integrity: sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==} @@ -3310,6 +3273,7 @@ packages: /acorn-walk@8.3.0: resolution: {integrity: sha512-FS7hV565M5l1R08MXqo8odwMTB02C2UqzB17RVgu9EyuYFBqJZ3/ZY97sQD5FewVu1UyDFc1yztUDrAwT0EypA==} engines: {node: '>=0.4.0'} + dev: true /acorn@8.11.2: resolution: {integrity: sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==} @@ -3380,6 +3344,7 @@ packages: /ansi-styles@5.2.0: resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} engines: {node: '>=10'} + dev: true /ansi-styles@6.2.1: resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} @@ -3450,12 +3415,14 @@ packages: resolution: {integrity: sha512-R5iJ5lkuHybztUfuOAznmboyjWq8O6sqNqtK7CLOqdydi54VNbORp49mb14KbWgG1QD3JFO9hJdZ+y4KutfdOQ==} dependencies: deep-equal: 2.2.2 + dev: true /array-buffer-byte-length@1.0.0: resolution: {integrity: sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==} dependencies: call-bind: 1.0.5 is-array-buffer: 3.0.2 + dev: true /array-includes@3.1.7: resolution: {integrity: sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ==} @@ -3519,6 +3486,7 @@ packages: /assertion-error@1.1.0: resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==} + dev: true /ast-kit@0.11.2(rollup@3.29.4): resolution: {integrity: sha512-Q0DjXK4ApbVoIf9GLyCo252tUH44iTnD/hiJ2TQaJeydYWSpKk0sI34+WMel8S9Wt5pbLgG02oJ+gkgX5DV3sQ==} @@ -3608,6 +3576,7 @@ packages: /available-typed-arrays@1.0.5: resolution: {integrity: sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==} engines: {node: '>= 0.4'} + dev: true /b4a@1.6.4: resolution: {integrity: sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==} @@ -3817,6 +3786,7 @@ packages: function-bind: 1.1.2 get-intrinsic: 1.2.2 set-function-length: 1.1.1 + dev: true /callsites@3.1.0: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} @@ -3853,6 +3823,7 @@ packages: loupe: 2.3.7 pathval: 1.1.1 type-detect: 4.0.8 + dev: true /chalk@2.4.2: resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} @@ -3905,6 +3876,7 @@ packages: resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} dependencies: get-func-name: 2.0.2 + dev: true /chokidar@3.5.3: resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} @@ -4018,6 +3990,7 @@ packages: /commander@10.0.1: resolution: {integrity: sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==} engines: {node: '>=14'} + dev: true /commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} @@ -4055,6 +4028,7 @@ packages: dependencies: ini: 1.3.8 proto-list: 1.2.4 + dev: true /consola@3.2.3: resolution: {integrity: sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ==} @@ -4288,6 +4262,7 @@ packages: engines: {node: '>=6'} dependencies: type-detect: 4.0.8 + dev: true /deep-equal@2.2.2: resolution: {integrity: sha512-xjVyBf0w5vH0I42jdAZzOKVldmPgSulmiyPRywoyq7HXC9qdgo17kxJE+rdnif5Tz6+pIrpJI8dCpMNLIGkUiA==} @@ -4310,6 +4285,7 @@ packages: which-boxed-primitive: 1.0.2 which-collection: 1.0.1 which-typed-array: 1.1.13 + dev: true /deep-is@0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} @@ -4341,6 +4317,7 @@ packages: get-intrinsic: 1.2.2 gopd: 1.0.1 has-property-descriptors: 1.0.1 + dev: true /define-lazy-prop@2.0.0: resolution: {integrity: sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==} @@ -4357,6 +4334,7 @@ packages: define-data-property: 1.1.1 has-property-descriptors: 1.0.1 object-keys: 1.1.1 + dev: true /defu@6.1.3: resolution: {integrity: sha512-Vy2wmG3NTkmHNg/kzpuvHhkqeIx3ODWqasgCRbKtbXEN0G+HpEEv9BtJLp7ZG1CZloFaC41Ah3ZFbq7aqCqMeQ==} @@ -4403,6 +4381,7 @@ packages: /diff-sequences@29.6.3: resolution: {integrity: sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dev: true /diff@4.0.2: resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} @@ -4434,6 +4413,7 @@ packages: /dom-accessibility-api@0.5.16: resolution: {integrity: sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==} + dev: true /dom-serializer@2.0.0: resolution: {integrity: sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==} @@ -4489,6 +4469,7 @@ packages: commander: 10.0.1 minimatch: 9.0.1 semver: 7.5.4 + dev: true /ee-first@1.1.1: resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} @@ -4602,6 +4583,7 @@ packages: is-string: 1.0.7 isarray: 2.0.5 stop-iteration-iterator: 1.0.0 + dev: true /es-set-tostringtag@2.0.2: resolution: {integrity: sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==} @@ -5024,6 +5006,7 @@ packages: /fake-indexeddb@5.0.1: resolution: {integrity: sha512-vxybH29Owtc6khV/Usy47B1g+eKwyhFiX8nwpCC4td320jvwrKQDH6vNtcJZgUzVxmfsSIlHzLKQzT76JMCO7A==} engines: {node: '>=18'} + dev: false /fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} @@ -5058,9 +5041,6 @@ packages: bser: 2.1.1 dev: true - /fflate@0.8.1: - resolution: {integrity: sha512-/exOvEuc+/iaUm105QIiOt4LpBdMTWsXxqR0HDF35vx3fmaKzw7354gTilCh5rkzEt8WYyG//ku3h3nRmd7CHQ==} - /file-entry-cache@6.0.1: resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} engines: {node: ^10.12.0 || >=12.0.0} @@ -5110,6 +5090,7 @@ packages: resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} dependencies: is-callable: 1.2.7 + dev: true /foreground-child@3.1.1: resolution: {integrity: sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==} @@ -5178,6 +5159,7 @@ packages: /functions-have-names@1.2.3: resolution: {integrity: sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==} + dev: true /gauge@3.0.2: resolution: {integrity: sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==} @@ -5203,6 +5185,7 @@ packages: /get-func-name@2.0.2: resolution: {integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==} + dev: true /get-intrinsic@1.2.2: resolution: {integrity: sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==} @@ -5211,6 +5194,7 @@ packages: has-proto: 1.0.1 has-symbols: 1.0.3 hasown: 2.0.0 + dev: true /get-package-type@0.1.0: resolution: {integrity: sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==} @@ -5357,6 +5341,7 @@ packages: resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} dependencies: get-intrinsic: 1.2.2 + dev: true /graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} @@ -5407,6 +5392,7 @@ packages: /has-bigints@1.0.2: resolution: {integrity: sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==} + dev: true /has-flag@3.0.0: resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} @@ -5421,20 +5407,24 @@ packages: resolution: {integrity: sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==} dependencies: get-intrinsic: 1.2.2 + dev: true /has-proto@1.0.1: resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} engines: {node: '>= 0.4'} + dev: true /has-symbols@1.0.3: resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} engines: {node: '>= 0.4'} + dev: true /has-tostringtag@1.0.0: resolution: {integrity: sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==} engines: {node: '>= 0.4'} dependencies: has-symbols: 1.0.3 + dev: true /has-unicode@2.0.1: resolution: {integrity: sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==} @@ -5611,6 +5601,7 @@ packages: get-intrinsic: 1.2.2 hasown: 2.0.0 side-channel: 1.0.4 + dev: true /ioredis@5.3.2: resolution: {integrity: sha512-1DKMMzlIHM02eBBVOFQ1+AolGjs6+xEcM4PDL7NqOS6szq7H9jSaEkIUH6/a5Hl241LzW6JLSiAbNvTQjUupUA==} @@ -5644,6 +5635,7 @@ packages: dependencies: call-bind: 1.0.5 has-tostringtag: 1.0.0 + dev: true /is-array-buffer@3.0.2: resolution: {integrity: sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==} @@ -5651,6 +5643,7 @@ packages: call-bind: 1.0.5 get-intrinsic: 1.2.2 is-typed-array: 1.1.12 + dev: true /is-arrayish@0.2.1: resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} @@ -5660,6 +5653,7 @@ packages: resolution: {integrity: sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==} dependencies: has-bigints: 1.0.2 + dev: true /is-binary-path@2.1.0: resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} @@ -5673,6 +5667,7 @@ packages: dependencies: call-bind: 1.0.5 has-tostringtag: 1.0.0 + dev: true /is-builtin-module@3.2.1: resolution: {integrity: sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==} @@ -5683,6 +5678,7 @@ packages: /is-callable@1.2.7: resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} engines: {node: '>= 0.4'} + dev: true /is-core-module@2.13.1: resolution: {integrity: sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==} @@ -5694,6 +5690,7 @@ packages: engines: {node: '>= 0.4'} dependencies: has-tostringtag: 1.0.0 + dev: true /is-docker@2.2.1: resolution: {integrity: sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==} @@ -5743,6 +5740,7 @@ packages: /is-map@2.0.2: resolution: {integrity: sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==} + dev: true /is-module@1.0.0: resolution: {integrity: sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==} @@ -5757,6 +5755,7 @@ packages: engines: {node: '>= 0.4'} dependencies: has-tostringtag: 1.0.0 + dev: true /is-number@7.0.0: resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} @@ -5787,14 +5786,17 @@ packages: dependencies: call-bind: 1.0.5 has-tostringtag: 1.0.0 + dev: true /is-set@2.0.2: resolution: {integrity: sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==} + dev: true /is-shared-array-buffer@1.0.2: resolution: {integrity: sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==} dependencies: call-bind: 1.0.5 + dev: true /is-ssh@1.4.0: resolution: {integrity: sha512-x7+VxdxOdlV3CYpjvRLBv5Lo9OJerlYanjwFrPR9fuGPjCiNiCzFgAWpiLAohSbsnH4ZAys3SBh+hq5rJosxUQ==} @@ -5814,21 +5816,25 @@ packages: engines: {node: '>= 0.4'} dependencies: has-tostringtag: 1.0.0 + dev: true /is-symbol@1.0.4: resolution: {integrity: sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==} engines: {node: '>= 0.4'} dependencies: has-symbols: 1.0.3 + dev: true /is-typed-array@1.1.12: resolution: {integrity: sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==} engines: {node: '>= 0.4'} dependencies: which-typed-array: 1.1.13 + dev: true /is-weakmap@2.0.1: resolution: {integrity: sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==} + dev: true /is-weakref@1.0.2: resolution: {integrity: sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==} @@ -5841,6 +5847,7 @@ packages: dependencies: call-bind: 1.0.5 get-intrinsic: 1.2.2 + dev: true /is-wsl@2.2.0: resolution: {integrity: sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==} @@ -5853,6 +5860,7 @@ packages: /isarray@2.0.5: resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} + dev: true /isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} @@ -6352,6 +6360,7 @@ packages: editorconfig: 1.0.4 glob: 8.1.0 nopt: 6.0.0 + dev: true /js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} @@ -6597,6 +6606,7 @@ packages: resolution: {integrity: sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==} dependencies: get-func-name: 2.0.2 + dev: true /lru-cache@10.0.1: resolution: {integrity: sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==} @@ -6616,6 +6626,7 @@ packages: /lz-string@1.5.0: resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==} hasBin: true + dev: true /magic-string-ast@0.3.0: resolution: {integrity: sha512-0shqecEPgdFpnI3AP90epXyxZy9g6CRZ+SZ7BcqFwYmtFEnZ1jpevcV5HoyVnlDS9gCnc1UIg3Rsvp3Ci7r8OA==} @@ -6746,6 +6757,7 @@ packages: engines: {node: '>=16 || 14 >=14.17'} dependencies: brace-expansion: 2.0.1 + dev: true /minimatch@9.0.3: resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} @@ -7043,6 +7055,7 @@ packages: hasBin: true dependencies: abbrev: 1.1.1 + dev: true /nopt@7.2.0: resolution: {integrity: sha512-CVDtwCdhYIvnAzFoJ6NJ6dX3oga9/HyciQDnG1vQDjSLMeKLJ4A93ZqYKDrgYSr1FBY5/hMYC+2VCi24pgpkGA==} @@ -7163,66 +7176,6 @@ packages: optionalDependencies: fsevents: 2.3.3 - /nuxt-vitest@0.11.5(@testing-library/vue@7.0.0)(@vitejs/plugin-vue-jsx@3.1.0)(@vitejs/plugin-vue@4.5.0)(happy-dom@12.10.3)(jsdom@22.1.0)(rollup@4.5.0)(vite@4.5.0)(vitest@0.33.0)(vue-router@4.2.5)(vue@3.3.8): - resolution: {integrity: sha512-uBdojodtD0/oq8mryU6KdFK7G9bppXFK+CgxMdRbPyTnAvKW31dJs5OFg4yE8EIa4whsezi16Ny+yvzaFtT/1Q==} - peerDependencies: - '@vitejs/plugin-vue': '*' - '@vitejs/plugin-vue-jsx': '*' - vite: '*' - vitest: ^0.24.5 || ^0.26.0 || ^0.27.0 || ^0.28.0 || ^0.29.0 || ^0.30.0 || ^0.33.0 - dependencies: - '@nuxt/kit': 3.8.1(rollup@4.5.0) - '@vitejs/plugin-vue': 4.5.0(vite@4.5.0)(vue@3.3.8) - '@vitejs/plugin-vue-jsx': 3.1.0(vite@4.5.0)(vue@3.3.8) - '@vitest/ui': 0.33.0(vitest@0.33.0) - defu: 6.1.3 - get-port-please: 3.1.1 - perfect-debounce: 1.0.0 - std-env: 3.4.3 - vite: 4.5.0(@types/node@20.8.10) - vitest: 0.33.0(happy-dom@12.10.3)(jsdom@22.1.0) - vitest-environment-nuxt: 0.11.5(@testing-library/vue@7.0.0)(happy-dom@12.10.3)(jsdom@22.1.0)(rollup@4.5.0)(vitest@0.33.0)(vue-router@4.2.5)(vue@3.3.8) - transitivePeerDependencies: - - '@testing-library/vue' - - '@vue/server-renderer' - - happy-dom - - jsdom - - rollup - - supports-color - - vue - - vue-router - dev: true - - /nuxt-vitest@0.11.5(@testing-library/vue@7.0.0)(@vitejs/plugin-vue-jsx@3.1.0)(@vitejs/plugin-vue@4.5.0)(happy-dom@12.10.3)(jsdom@22.1.0)(rollup@4.5.0)(vite@5.0.0)(vitest@0.33.0)(vue-router@4.2.5)(vue@3.3.8): - resolution: {integrity: sha512-uBdojodtD0/oq8mryU6KdFK7G9bppXFK+CgxMdRbPyTnAvKW31dJs5OFg4yE8EIa4whsezi16Ny+yvzaFtT/1Q==} - peerDependencies: - '@vitejs/plugin-vue': '*' - '@vitejs/plugin-vue-jsx': '*' - vite: '*' - vitest: ^0.24.5 || ^0.26.0 || ^0.27.0 || ^0.28.0 || ^0.29.0 || ^0.30.0 || ^0.33.0 - dependencies: - '@nuxt/kit': 3.8.1(rollup@4.5.0) - '@vitejs/plugin-vue': 4.5.0(vite@5.0.0)(vue@3.3.8) - '@vitejs/plugin-vue-jsx': 3.1.0(vite@5.0.0)(vue@3.3.8) - '@vitest/ui': 0.33.0(vitest@0.33.0) - defu: 6.1.3 - get-port-please: 3.1.1 - perfect-debounce: 1.0.0 - std-env: 3.4.3 - vite: 5.0.0 - vitest: 0.33.0(happy-dom@12.10.3)(jsdom@22.1.0) - vitest-environment-nuxt: 0.11.5(@testing-library/vue@7.0.0)(happy-dom@12.10.3)(jsdom@22.1.0)(rollup@4.5.0)(vitest@0.33.0)(vue-router@4.2.5)(vue@3.3.8) - transitivePeerDependencies: - - '@testing-library/vue' - - '@vue/server-renderer' - - happy-dom - - jsdom - - rollup - - supports-color - - vue - - vue-router - dev: false - /nuxt@3.8.1(@types/node@20.8.10)(eslint@8.54.0)(rollup@4.5.0)(typescript@5.2.2)(vite@4.5.0): resolution: {integrity: sha512-RSGO56Gv0x2f6AXWw4o4GoBaVdsD0qkPCjrX7Ud/jzH3cRJoyYMPuq/9AOLvf2o1ecZWl39j5elqJ4QHmggyOA==} engines: {node: ^14.18.0 || >=16.10.0} @@ -7554,6 +7507,7 @@ packages: /object-inspect@1.13.1: resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==} + dev: true /object-is@1.1.5: resolution: {integrity: sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==} @@ -7561,10 +7515,12 @@ packages: dependencies: call-bind: 1.0.5 define-properties: 1.2.1 + dev: true /object-keys@1.1.1: resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} engines: {node: '>= 0.4'} + dev: true /object.assign@4.1.4: resolution: {integrity: sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==} @@ -7574,6 +7530,7 @@ packages: define-properties: 1.2.1 has-symbols: 1.0.3 object-keys: 1.1.1 + dev: true /object.fromentries@2.0.7: resolution: {integrity: sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==} @@ -7692,6 +7649,7 @@ packages: engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} dependencies: yocto-queue: 1.0.0 + dev: true /p-locate@4.1.0: resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} @@ -7821,6 +7779,7 @@ packages: /pathval@1.1.1: resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} + dev: true /perfect-debounce@1.0.0: resolution: {integrity: sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==} @@ -8156,6 +8115,7 @@ packages: ansi-regex: 5.0.1 ansi-styles: 5.2.0 react-is: 17.0.2 + dev: true /pretty-format@29.7.0: resolution: {integrity: sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==} @@ -8164,6 +8124,7 @@ packages: '@jest/schemas': 29.6.3 ansi-styles: 5.2.0 react-is: 18.2.0 + dev: true /proc-log@3.0.0: resolution: {integrity: sha512-++Vn7NS4Xf9NacaU9Xq3URUuqZETPsf8L4j5/ckhaRYsfPeRyzGw+iDjFhV/Jr3uNmTvvddEJFWh5R1gRgUH8A==} @@ -8196,6 +8157,7 @@ packages: /proto-list@1.2.4: resolution: {integrity: sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==} + dev: true /protocols@2.0.1: resolution: {integrity: sha512-/XJ368cyBJ7fzLMwLKv1e4vLxOju2MNAIokcr7meSaNcVbWz/CPcW22cP04mwxOErdA5mwjA8Q6w/cdAQxVn7Q==} @@ -8241,9 +8203,11 @@ packages: /react-is@17.0.2: resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==} + dev: true /react-is@18.2.0: resolution: {integrity: sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==} + dev: true /read-package-json-fast@3.0.2: resolution: {integrity: sha512-0J+Msgym3vrLOUB3hzQCuZHII0xkNGCtz/HJH9xZshwv9DbDwkw1KaE3gx/e2J5rpEY5rtOy6cyhKOPrkP7FZw==} @@ -8322,6 +8286,7 @@ packages: /regenerator-runtime@0.14.0: resolution: {integrity: sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==} + dev: true /regexp-tree@0.1.27: resolution: {integrity: sha512-iETxpjK6YoRWJG5o6hXLwvjYAoW+FEZn9os0PD/b6AP6xQwsa/Y7lCVgIixBbUPMfhu+i2LtdeAqVTgGlQarfA==} @@ -8335,6 +8300,7 @@ packages: call-bind: 1.0.5 define-properties: 1.2.1 set-function-name: 2.0.1 + dev: true /regjsparser@0.10.0: resolution: {integrity: sha512-qx+xQGZVsy55CH0a1hiVwHmqjLryfh7wQyF5HO07XJ9f7dQMY/gPQHhlyDkIzJKC+x2fUCpCcUODUUUFrm7SHA==} @@ -8582,6 +8548,7 @@ packages: get-intrinsic: 1.2.2 gopd: 1.0.1 has-property-descriptors: 1.0.1 + dev: true /set-function-name@2.0.1: resolution: {integrity: sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==} @@ -8590,6 +8557,7 @@ packages: define-data-property: 1.1.1 functions-have-names: 1.2.3 has-property-descriptors: 1.0.1 + dev: true /setprototypeof@1.2.0: resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} @@ -8613,9 +8581,11 @@ packages: call-bind: 1.0.5 get-intrinsic: 1.2.2 object-inspect: 1.13.1 + dev: true /siginfo@2.0.0: resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} + dev: true /signal-exit@3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} @@ -8750,6 +8720,7 @@ packages: /stackback@0.0.2: resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + dev: true /standard-as-callback@2.1.0: resolution: {integrity: sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A==} @@ -8769,6 +8740,7 @@ packages: engines: {node: '>= 0.4'} dependencies: internal-slot: 1.0.6 + dev: true /streamx@2.15.2: resolution: {integrity: sha512-b62pAV/aeMjUoRN2C/9F0n+G8AfcJjNC0zw/ZmOHeFsIe4m4GzjVW9m6VHXVjk536NbdU9JRwKMJRfkc+zUFTg==} @@ -8985,14 +8957,17 @@ packages: /tinybench@2.5.1: resolution: {integrity: sha512-65NKvSuAVDP/n4CqH+a9w2kTlLReS9vhsAP06MWx+/89nMinJyB2icyl58RIcqCmIggpojIGeuJGhjU1aGMBSg==} + dev: true /tinypool@0.6.0: resolution: {integrity: sha512-FdswUUo5SxRizcBc6b1GSuLpLjisa8N8qMyYoP3rl+bym+QauhtJP5bvZY1ytt8krKGmMLYIRl36HBZfeAoqhQ==} engines: {node: '>=14.0.0'} + dev: true /tinyspy@2.2.0: resolution: {integrity: sha512-d2eda04AN/cPOR89F7Xv5bK/jrQEhmcLFe6HFldoeO9AJtps+fqEnh486vnT/8y4bw38pSyxDcTCAq+Ks2aJTg==} engines: {node: '>=14.0.0'} + dev: true /titleize@3.0.0: resolution: {integrity: sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==} @@ -9140,6 +9115,7 @@ packages: /type-detect@4.0.8: resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} engines: {node: '>=4'} + dev: true /type-fest@0.20.2: resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==} @@ -9787,46 +9763,7 @@ packages: rollup: 4.5.0 optionalDependencies: fsevents: 2.3.3 - - /vitest-environment-nuxt@0.11.5(@testing-library/vue@7.0.0)(happy-dom@12.10.3)(jsdom@22.1.0)(rollup@4.5.0)(vitest@0.33.0)(vue-router@4.2.5)(vue@3.3.8): - resolution: {integrity: sha512-PV21wpOen6gIjuPHQpOoMtdwXC79EphRQL+NUI4LoVjSb5mHtWYYr9R0PUrrGckdu8v+NzaXE4WFiumK07TA4w==} - peerDependencies: - '@testing-library/vue': 8.0.1 - happy-dom: ^9.10.9 || ^10.0.0 || ^11.0.0 || ^12.0.0 - jsdom: ^22.0.0 - vitest: ^0.24.5 || ^0.26.0 || ^0.27.0 || ^0.28.0 || ^0.29.0 || ^0.30.0 || ^0.33.0 - vue: ^3.2.45 - vue-router: ^4.0.0 - peerDependenciesMeta: - '@testing-library/vue': - optional: true - happy-dom: - optional: true - jsdom: - optional: true - dependencies: - '@nuxt/kit': 3.8.1(rollup@4.5.0) - '@testing-library/vue': 7.0.0(@vue/compiler-sfc@3.3.8)(vue@3.3.8) - '@vue/test-utils': 2.4.1(vue@3.3.8) - defu: 6.1.3 - estree-walker: 3.0.3 - fake-indexeddb: 5.0.1 - h3: 1.8.2 - happy-dom: 12.10.3 - jsdom: 22.1.0 - local-pkg: 0.5.0 - magic-string: 0.30.5 - ofetch: 1.3.3 - radix3: 1.1.0 - ufo: 1.3.2 - unenv: 1.7.4 - vitest: 0.33.0(happy-dom@12.10.3)(jsdom@22.1.0) - vue: 3.3.8(typescript@5.2.2) - vue-router: 4.2.5(vue@3.3.8) - transitivePeerDependencies: - - '@vue/server-renderer' - - rollup - - supports-color + dev: true /vitest@0.33.0(happy-dom@12.10.3)(jsdom@22.1.0): resolution: {integrity: sha512-1CxaugJ50xskkQ0e969R/hW47za4YXDUfWJDxip1hwbnhUjYolpfUn2AMOulqG/Dtd9WYAtkHmM/m3yKVrEejQ==} @@ -9893,6 +9830,7 @@ packages: - sugarss - supports-color - terser + dev: true /vscode-jsonrpc@6.0.0: resolution: {integrity: sha512-wnJA4BnEjOSyFMvjZdpiOwhSq9uDoK8e/kpRJDTaMYzwlkrhG1fwDIZI94CLsLzlCK5cIbMMtFlJlfR57Lavmg==} @@ -9934,9 +9872,7 @@ packages: /vue-component-type-helpers@1.8.22: resolution: {integrity: sha512-LK3wJHs3vJxHG292C8cnsRusgyC5SEZDCzDCD01mdE/AoREFMl2tzLRuzwyuEsOIz13tqgBcnvysN3Lxsa14Fw==} - - /vue-component-type-helpers@1.8.4: - resolution: {integrity: sha512-6bnLkn8O0JJyiFSIF0EfCogzeqNXpnjJ0vW/SZzNHfe6sPx30lTtTXlE5TFs2qhJlAtDFybStVNpL73cPe3OMQ==} + dev: true /vue-devtools-stub@0.1.0: resolution: {integrity: sha512-RutnB7X8c5hjq39NceArgXg28WZtZpGc3+J16ljMiYnFhKvd8hITxSWQSQ5bvldxMDU6gG5mkxl1MTQLXckVSQ==} @@ -10039,6 +9975,7 @@ packages: is-number-object: 1.0.7 is-string: 1.0.7 is-symbol: 1.0.4 + dev: true /which-collection@1.0.1: resolution: {integrity: sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==} @@ -10047,6 +9984,7 @@ packages: is-set: 2.0.2 is-weakmap: 2.0.1 is-weakset: 2.0.2 + dev: true /which-typed-array@1.1.13: resolution: {integrity: sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==} @@ -10057,6 +9995,7 @@ packages: for-each: 0.3.3 gopd: 1.0.1 has-tostringtag: 1.0.0 + dev: true /which@2.0.2: resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} @@ -10086,6 +10025,7 @@ packages: dependencies: siginfo: 2.0.0 stackback: 0.0.2 + dev: true /wide-align@1.1.5: resolution: {integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==} @@ -10180,6 +10120,7 @@ packages: /yocto-queue@1.0.0: resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==} engines: {node: '>=12.20'} + dev: true /zhead@2.2.4: resolution: {integrity: sha512-8F0OI5dpWIA5IGG5NHUg9staDwz/ZPxZtvGVf01j7vHqSyZ0raHY+78atOVxRqb73AotX22uV1pXt3gYSstGag==} diff --git a/src/config.ts b/src/config.ts index 27a81570e..856babec4 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1 +1 @@ -export * from 'nuxt-vitest/config' +export * from './nuxt-vitest/config' diff --git a/src/nuxt-vitest/config.ts b/src/nuxt-vitest/config.ts index 767746b73..2723612af 100644 --- a/src/nuxt-vitest/config.ts +++ b/src/nuxt-vitest/config.ts @@ -24,14 +24,14 @@ async function startNuxtAndGetViteConfig( { ssr: false, test: true, - modules: ['nuxt-vitest'], + modules: ['@nuxt/test-utils/module'], }, overrides ), }) if ( - !nuxt.options._installedModules.find(i => i?.meta?.name === 'nuxt-vitest') + !nuxt.options._installedModules.find(i => i?.meta?.name === '@nuxt/test-utils/module') ) { throw new Error( 'Failed to load nuxt-vitest module. You may need to add it to your nuxt.config.' diff --git a/src/nuxt-vitest/module.ts b/src/nuxt-vitest/module.ts index af9d25a54..b6dd25c63 100644 --- a/src/nuxt-vitest/module.ts +++ b/src/nuxt-vitest/module.ts @@ -23,7 +23,7 @@ const vitePluginBlocklist = ['vite-plugin-vue-inspector', 'vite-plugin-inspect'] export default defineNuxtModule({ meta: { - name: 'nuxt-vitest', + name: '@nuxt/test-utils', configKey: 'vitest', }, defaults: { diff --git a/src/runtime-utils.ts b/src/runtime-utils.ts index 09245f80e..71e4a7d22 100644 --- a/src/runtime-utils.ts +++ b/src/runtime-utils.ts @@ -1 +1 @@ -export * from 'vitest-environment-nuxt/utils' +export * from './vitest-environment-nuxt/utils' diff --git a/src/vitest-environment-nuxt/runtime/mock.ts b/src/vitest-environment-nuxt/runtime/mock.ts index ea463608b..50e4ceaf7 100644 --- a/src/vitest-environment-nuxt/runtime/mock.ts +++ b/src/vitest-environment-nuxt/runtime/mock.ts @@ -23,7 +23,7 @@ export type OptionalFunction = T | (() => Awaitable) * @param options - factory function that returns the mocked data or an object containing both the `handler` and the `method` properties. * @example * ```ts - * import { registerEndpoint } from 'nuxt-vitest/utils' + * import { registerEndpoint } from '@nuxt/test-utils/runtime-utils' * * registerEndpoint("/test/", () => { * test: "test-field" @@ -69,7 +69,7 @@ export function registerEndpoint( * @param _factory - factory function that returns mocked import. * @example * ```ts - * import { mockNuxtImport } from 'nuxt-vitest/utils' + * import { mockNuxtImport } from '@nuxt/test-utils/runtime-utils' * * mockNuxtImport('useStorage', () => { * return () => { @@ -94,7 +94,7 @@ export function mockNuxtImport( * @param setup - factory function that returns the mocked component. * @example * ```ts - * import { mockComponent } from 'nuxt-vitest/utils' + * import { mockComponent } from '@nuxt/test-utils/runtime-utils' * * mockComponent('MyComponent', { * props: { diff --git a/src/vitest-environment-nuxt/runtime/render.ts b/src/vitest-environment-nuxt/runtime/render.ts index c7ef329e3..5ce84388d 100644 --- a/src/vitest-environment-nuxt/runtime/render.ts +++ b/src/vitest-environment-nuxt/runtime/render.ts @@ -29,7 +29,7 @@ export const WRAPPER_EL_ID = 'test-wrapper' * * ```ts * // tests/components/SomeComponents.nuxt.spec.ts - * import { renderSuspended } from 'nuxt-vitest/utils' + * import { renderSuspended } from '@nuxt/test-utils/runtime-utils' * * it('can render some component', async () => { * const { html } = await renderSuspended(SomeComponent) @@ -40,7 +40,7 @@ export const WRAPPER_EL_ID = 'test-wrapper' * }) * * // tests/App.nuxt.spec.ts - * import { renderSuspended } from 'nuxt-vitest/utils' + * import { renderSuspended } from '@nuxt/test-utils/runtime-utils' * import { screen } from '@testing-library/vue' * * it('can also mount an app', async () => { diff --git a/src/vitest-environment.ts b/src/vitest-environment.ts index a8e0bfcb8..1d77560c2 100644 --- a/src/vitest-environment.ts +++ b/src/vitest-environment.ts @@ -1 +1 @@ -export { default } from 'vitest-environment-nuxt' +export { default } from './vitest-environment-nuxt/index' diff --git a/test/fixtures/nuxt-vitest/nuxt.config.ts b/test/fixtures/nuxt-vitest/nuxt.config.ts index ef27dd468..58a309580 100644 --- a/test/fixtures/nuxt-vitest/nuxt.config.ts +++ b/test/fixtures/nuxt-vitest/nuxt.config.ts @@ -1,6 +1,6 @@ // https://v3.nuxtjs.org/api/configuration/nuxt.config export default defineNuxtConfig({ - modules: ['nuxt-vitest', '@nuxt/devtools', '~/modules/custom'], + modules: ['@nuxt/test-utils/module', '@nuxt/devtools', '~/modules/custom'], vitest: { startOnBoot: true, logToConsole: true, @@ -18,19 +18,6 @@ export default defineNuxtConfig({ imports: { injectAtEnd: true, }, - vite: { - // TODO: fix bug with stubbing root package - resolve: { - alias: { - 'nuxt-vitest/config': '../packages/vitest-environment-nuxt/src/config', - 'nuxt-vitest/utils': '../packages/vitest-environment-nuxt/src/utils', - 'vitest-environment-nuxt/utils': - '../packages/vitest-environment-nuxt/src/utils', - 'vitest-environment-nuxt': - '../packages/vitest-environment-nuxt/src/index', - }, - }, - }, runtimeConfig: { public: { hello: 'world', diff --git a/test/fixtures/nuxt-vitest/package.json b/test/fixtures/nuxt-vitest/package.json index ff112fdd3..5775b845c 100644 --- a/test/fixtures/nuxt-vitest/package.json +++ b/test/fixtures/nuxt-vitest/package.json @@ -15,14 +15,13 @@ }, "devDependencies": { "@nuxt/devtools": "1.0.2", + "@nuxt/test-utils": "latest", "@testing-library/vue": "8.0.1", "happy-dom": "12.1.2", "jsdom": "22.1.0", - "nuxt": "3.7.4", - "nuxt-vitest": "0.11.3", + "nuxt": "3.8.1", "typescript": "5.2.2", "vitest": "0.33.0", - "vitest-environment-nuxt": "0.11.3", "vue-tsc": "1.8.19" }, "version": "0.10.2", diff --git a/test/fixtures/nuxt-vitest/vitest.config.ts b/test/fixtures/nuxt-vitest/vitest.config.ts index 52f824230..dcbd3fc3f 100644 --- a/test/fixtures/nuxt-vitest/vitest.config.ts +++ b/test/fixtures/nuxt-vitest/vitest.config.ts @@ -1,5 +1,5 @@ import { fileURLToPath } from 'node:url' -import { defineVitestConfig } from 'nuxt-vitest/config' +import { defineVitestConfig } from '@nuxt/test-utils/config' export default defineVitestConfig({ test: { From b56d97dfcc9c9a1f3133942aa373a4e5d05dfde3 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 21 Nov 2023 10:47:45 +0000 Subject: [PATCH 02/15] chore: move playground and update code --- build.config.ts | 3 + examples/app/package.json | 3 +- examples/module/package.json | 3 +- package.json | 14 +- pnpm-lock.yaml | 797 ++---------------- src/module.ts | 2 +- src/nuxt-vitest/config.ts | 3 +- src/nuxt-vitest/mock-module.ts | 325 +++++++ src/nuxt-vitest/module.ts | 9 +- src/nuxt-vitest/utils.ts | 2 +- src/vitest-environment-nuxt/index.ts | 1 - src/vitest-environment-nuxt/module.ts | 11 - src/vitest-environment-nuxt/modules/mock.ts | 328 ------- stubs/vitest-environment-nuxt/index.mjs | 1 + stubs/vitest-environment-nuxt/package.json | 8 + test/fixtures/nuxt-vitest/nuxt.config.ts | 10 + .../{nuxt-vitest => runtime}/.gitignore | 0 .../{nuxt-vitest => runtime}/app.config.ts | 0 .../fixtures/{nuxt-vitest => runtime}/app.vue | 0 .../components/ExportDefaultComponent.vue | 0 .../ExportDefaultReturnsRenderComponent.vue | 0 .../ExportDefaultWithRenderComponent.vue | 0 .../components/ExportDefineComponent.vue | 0 .../components/FetchComponent.vue | 0 .../components/GlobalComponent.global.vue | 0 .../components/IndexedDbComponent.vue | 0 .../components/OptionsComponent.vue | 0 .../components/SomeComponent.vue | 0 .../components/WrapperTests.vue | 0 .../composables/auto-import-mock.ts | 0 .../composables/use-default-export.ts | 0 .../composables/use-single-state.ts | 0 .../modules/custom.ts | 0 .../runtime/composables/auto-import-mock.ts | 0 test/fixtures/runtime/nuxt.config.ts | 36 + .../{nuxt-vitest => runtime}/package.json | 2 + .../pages/[...slug].vue | 0 .../{nuxt-vitest => runtime}/pages/index.vue | 0 .../{nuxt-vitest => runtime}/plugins/async.ts | 0 .../{nuxt-vitest => runtime}/plugins/auth.ts | 0 .../plugins/indexeddb.ts | 0 .../tests/nuxt/auto-import-mock.spec.ts | 2 +- .../tests/nuxt/auto-import.spec.ts | 0 .../tests/nuxt/config.spec.ts | 0 .../nuxt/export-define-component.spec.ts | 2 +- .../tests/nuxt/index.spec.ts | 2 +- .../tests/nuxt/mock-component-1.spec.ts | 2 +- .../tests/nuxt/mock-component-2.spec.ts | 2 +- .../mock-component-expose-setup-state.spec.ts | 2 +- .../tests/nuxt/mock-indexeddb.spec.ts | 2 +- .../tests/nuxt/mock-nuxt-composable-1.spec.ts | 2 +- .../tests/nuxt/mock-nuxt-composable-2.spec.ts | 2 +- .../tests/nuxt/mock-nuxt-composable-3.spec.ts | 2 +- .../tests/nuxt/mocks/MockComponent.vue | 0 .../tests/nuxt/utils-render.spec.ts | 2 +- .../tests/setup/mocks.ts | 2 +- .../tests/unit/index.spec.ts | 0 .../{nuxt-vitest => runtime}/tsconfig.json | 0 .../{nuxt-vitest => runtime}/vitest.config.ts | 2 +- tsconfig.json | 13 +- 60 files changed, 505 insertions(+), 1092 deletions(-) create mode 100644 src/nuxt-vitest/mock-module.ts delete mode 100644 src/vitest-environment-nuxt/module.ts delete mode 100644 src/vitest-environment-nuxt/modules/mock.ts create mode 100644 stubs/vitest-environment-nuxt/index.mjs create mode 100644 stubs/vitest-environment-nuxt/package.json rename test/fixtures/{nuxt-vitest => runtime}/.gitignore (100%) rename test/fixtures/{nuxt-vitest => runtime}/app.config.ts (100%) rename test/fixtures/{nuxt-vitest => runtime}/app.vue (100%) rename test/fixtures/{nuxt-vitest => runtime}/components/ExportDefaultComponent.vue (100%) rename test/fixtures/{nuxt-vitest => runtime}/components/ExportDefaultReturnsRenderComponent.vue (100%) rename test/fixtures/{nuxt-vitest => runtime}/components/ExportDefaultWithRenderComponent.vue (100%) rename test/fixtures/{nuxt-vitest => runtime}/components/ExportDefineComponent.vue (100%) rename test/fixtures/{nuxt-vitest => runtime}/components/FetchComponent.vue (100%) rename test/fixtures/{nuxt-vitest => runtime}/components/GlobalComponent.global.vue (100%) rename test/fixtures/{nuxt-vitest => runtime}/components/IndexedDbComponent.vue (100%) rename test/fixtures/{nuxt-vitest => runtime}/components/OptionsComponent.vue (100%) rename test/fixtures/{nuxt-vitest => runtime}/components/SomeComponent.vue (100%) rename test/fixtures/{nuxt-vitest => runtime}/components/WrapperTests.vue (100%) rename test/fixtures/{nuxt-vitest => runtime}/composables/auto-import-mock.ts (100%) rename test/fixtures/{nuxt-vitest => runtime}/composables/use-default-export.ts (100%) rename test/fixtures/{nuxt-vitest => runtime}/composables/use-single-state.ts (100%) rename test/fixtures/{nuxt-vitest => runtime}/modules/custom.ts (100%) rename test/fixtures/{nuxt-vitest => runtime}/modules/runtime/composables/auto-import-mock.ts (100%) create mode 100644 test/fixtures/runtime/nuxt.config.ts rename test/fixtures/{nuxt-vitest => runtime}/package.json (92%) rename test/fixtures/{nuxt-vitest => runtime}/pages/[...slug].vue (100%) rename test/fixtures/{nuxt-vitest => runtime}/pages/index.vue (100%) rename test/fixtures/{nuxt-vitest => runtime}/plugins/async.ts (100%) rename test/fixtures/{nuxt-vitest => runtime}/plugins/auth.ts (100%) rename test/fixtures/{nuxt-vitest => runtime}/plugins/indexeddb.ts (100%) rename test/fixtures/{nuxt-vitest => runtime}/tests/nuxt/auto-import-mock.spec.ts (94%) rename test/fixtures/{nuxt-vitest => runtime}/tests/nuxt/auto-import.spec.ts (100%) rename test/fixtures/{nuxt-vitest => runtime}/tests/nuxt/config.spec.ts (100%) rename test/fixtures/{nuxt-vitest => runtime}/tests/nuxt/export-define-component.spec.ts (96%) rename test/fixtures/{nuxt-vitest => runtime}/tests/nuxt/index.spec.ts (98%) rename test/fixtures/{nuxt-vitest => runtime}/tests/nuxt/mock-component-1.spec.ts (86%) rename test/fixtures/{nuxt-vitest => runtime}/tests/nuxt/mock-component-2.spec.ts (84%) rename test/fixtures/{nuxt-vitest => runtime}/tests/nuxt/mock-component-expose-setup-state.spec.ts (82%) rename test/fixtures/{nuxt-vitest => runtime}/tests/nuxt/mock-indexeddb.spec.ts (87%) rename test/fixtures/{nuxt-vitest => runtime}/tests/nuxt/mock-nuxt-composable-1.spec.ts (84%) rename test/fixtures/{nuxt-vitest => runtime}/tests/nuxt/mock-nuxt-composable-2.spec.ts (75%) rename test/fixtures/{nuxt-vitest => runtime}/tests/nuxt/mock-nuxt-composable-3.spec.ts (87%) rename test/fixtures/{nuxt-vitest => runtime}/tests/nuxt/mocks/MockComponent.vue (100%) rename test/fixtures/{nuxt-vitest => runtime}/tests/nuxt/utils-render.spec.ts (97%) rename test/fixtures/{nuxt-vitest => runtime}/tests/setup/mocks.ts (84%) rename test/fixtures/{nuxt-vitest => runtime}/tests/unit/index.spec.ts (100%) rename test/fixtures/{nuxt-vitest => runtime}/tsconfig.json (100%) rename test/fixtures/{nuxt-vitest => runtime}/vitest.config.ts (89%) diff --git a/build.config.ts b/build.config.ts index fb9b2599d..bb970dfb7 100644 --- a/build.config.ts +++ b/build.config.ts @@ -13,5 +13,8 @@ export default defineBuildConfig({ { input: 'src/runtime/', outDir: 'dist/runtime', format: 'esm' } ], externals: [ + "#app/entry", + "#build/root-component.mjs", + "#imports", ] }) diff --git a/examples/app/package.json b/examples/app/package.json index 801b0eed1..9f49c4144 100644 --- a/examples/app/package.json +++ b/examples/app/package.json @@ -17,6 +17,7 @@ }, "devDependencies": { "@nuxt/test-utils": "latest", - "happy-dom": "^12.10.3" + "happy-dom": "^12.10.3", + "vitest-environment-nuxt": "0.0.0" } } diff --git a/examples/module/package.json b/examples/module/package.json index c127a81f5..5101a94d6 100644 --- a/examples/module/package.json +++ b/examples/module/package.json @@ -37,6 +37,7 @@ "@nuxt/test-utils": "latest", "changelogen": "^0.5.5", "nuxt": "^3.8.2", - "vitest": "0.33.0" + "vitest": "0.33.0", + "vitest-environment-nuxt": "0.0.0" } } diff --git a/package.json b/package.json index a4148c7e0..4aef93870 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "lint:fix": "eslint --ext .vue,.ts,.js,.mjs . --fix", "test:examples": "pnpm -r test", "prepack": "unbuild", - "dev:prepare": "unbuild --stub", + "dev:prepare": "nuxi prepare && unbuild --stub && pnpm -r dev:prepare", "release": "pnpm test:examples && pnpm build && changelogen --release --push && pnpm publish" }, "dependencies": { @@ -56,6 +56,7 @@ "devDependencies": { "@jest/globals": "29.7.0", "@nuxt/eslint-config": "0.2.0", + "@nuxt/module-builder": "^0.5.2", "@testing-library/vue": "^7.0.0", "@types/estree": "^1.0.5", "@vitejs/plugin-vue": "^4.5.0", @@ -64,15 +65,16 @@ "changelogen": "0.5.5", "eslint": "8.54.0", "eslint-plugin-import": "2.29.0", - "h3": "^1.9.0", "eslint-plugin-jsdoc": "46.9.0", "eslint-plugin-no-only-tests": "3.1.0", "eslint-plugin-unicorn": "49.0.0", + "h3": "^1.9.0", + "nuxt": "^3.8.2", "playwright-core": "1.40.0", - "rollup": "^4.5.0", + "rollup": "^3.29.4", "unbuild": "latest", "unimport": "^3.5.0", - "vite": "^5.0.0", + "vite": "^4.5.0", "vitest": "0.33.0", "vue-router": "^4.2.5" }, @@ -81,6 +83,7 @@ "@testing-library/vue": "8.0.1", "@vitejs/plugin-vue": "*", "@vitejs/plugin-vue-jsx": "*", + "@vue/test-utils": "^2.4.2", "h3": "*", "happy-dom": "^9.10.9 || ^10.0.0 || ^11.0.0 || ^12.0.0", "jsdom": "^22.0.0", @@ -114,7 +117,8 @@ } }, "resolutions": { - "@nuxt/test-utils": "workspace:*" + "@nuxt/test-utils": "workspace:*", + "vitest-environment-nuxt": "file:./stubs/vitest-environment-nuxt" }, "engines": { "node": "^14.18.0 || >=16.10.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 98f1f25b4..91cdec878 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,6 +6,7 @@ settings: overrides: '@nuxt/test-utils': workspace:* + vitest-environment-nuxt: file:./stubs/vitest-environment-nuxt importers: @@ -13,10 +14,10 @@ importers: dependencies: '@nuxt/kit': specifier: ^3.8.2 - version: 3.8.2(rollup@4.5.0) + version: 3.8.2(rollup@3.29.4) '@nuxt/schema': specifier: ^3.8.2 - version: 3.8.2(rollup@4.5.0) + version: 3.8.2(rollup@3.29.4) consola: specifier: ^3.2.3 version: 3.2.3 @@ -81,6 +82,9 @@ importers: '@nuxt/eslint-config': specifier: 0.2.0 version: 0.2.0(eslint@8.54.0) + '@nuxt/module-builder': + specifier: ^0.5.2 + version: 0.5.3(@nuxt/kit@3.8.2)(nuxi@3.10.0)(typescript@5.2.2) '@testing-library/vue': specifier: ^7.0.0 version: 7.0.0(@vue/compiler-sfc@3.3.8)(vue@3.3.8) @@ -89,10 +93,10 @@ importers: version: 1.0.5 '@vitejs/plugin-vue': specifier: ^4.5.0 - version: 4.5.0(vite@5.0.0)(vue@3.3.8) + version: 4.5.0(vite@4.5.0)(vue@3.3.8) '@vitejs/plugin-vue-jsx': specifier: ^3.1.0 - version: 3.1.0(vite@5.0.0)(vue@3.3.8) + version: 3.1.0(vite@4.5.0)(vue@3.3.8) '@vue/test-utils': specifier: ^2.4.2 version: 2.4.2(vue@3.3.8) @@ -117,21 +121,24 @@ importers: h3: specifier: ^1.9.0 version: 1.9.0 + nuxt: + specifier: ^3.8.2 + version: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0) playwright-core: specifier: 1.40.0 version: 1.40.0 rollup: - specifier: ^4.5.0 - version: 4.5.0 + specifier: ^3.29.4 + version: 3.29.4 unbuild: specifier: latest version: 2.0.0(typescript@5.2.2) unimport: specifier: ^3.5.0 - version: 3.5.0(rollup@4.5.0) + version: 3.5.0(rollup@3.29.4) vite: - specifier: ^5.0.0 - version: 5.0.0 + specifier: ^4.5.0 + version: 4.5.0(@types/node@20.8.10) vitest: specifier: 0.33.0 version: 0.33.0(happy-dom@12.10.3)(jsdom@22.1.0) @@ -143,7 +150,7 @@ importers: dependencies: nuxt: specifier: ^3.8.2 - version: 3.8.2(eslint@8.54.0)(rollup@4.5.0)(typescript@5.2.2)(vite@4.5.0) + version: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0) vue: specifier: ^3.3.8 version: 3.3.8(typescript@5.2.2) @@ -157,12 +164,15 @@ importers: happy-dom: specifier: ^12.10.3 version: 12.10.3 + vitest-environment-nuxt: + specifier: file:/Users/daniel/code/nuxt/test-utils/stubs/vitest-environment-nuxt + version: file:stubs/vitest-environment-nuxt examples/app-jest: dependencies: nuxt: specifier: ^3.8.2 - version: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@4.5.0)(typescript@5.2.2)(vite@4.5.0) + version: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0) vue: specifier: ^3.3.8 version: 3.3.8(typescript@5.2.2) @@ -218,10 +228,13 @@ importers: version: 0.5.5 nuxt: specifier: ^3.8.2 - version: 3.8.2(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0) + version: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0) vitest: specifier: 0.33.0 version: 0.33.0(happy-dom@12.10.3)(jsdom@22.1.0) + vitest-environment-nuxt: + specifier: file:/Users/daniel/code/nuxt/test-utils/stubs/vitest-environment-nuxt + version: file:stubs/vitest-environment-nuxt examples/module/playground: dependencies: @@ -234,7 +247,7 @@ importers: devDependencies: nuxt: specifier: ^3.8.2 - version: 3.8.2(eslint@8.54.0)(rollup@4.5.0)(typescript@5.2.2)(vite@4.5.0) + version: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0) packages: @@ -1509,23 +1522,7 @@ packages: '@nuxt/kit': 3.8.2(rollup@3.29.4) '@nuxt/schema': 3.8.2(rollup@3.29.4) execa: 7.2.0 - nuxt: 3.8.2(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0) - vite: 4.5.0(@types/node@20.8.10) - transitivePeerDependencies: - - rollup - - supports-color - dev: true - - /@nuxt/devtools-kit@1.0.3(nuxt@3.8.2)(rollup@4.5.0)(vite@4.5.0): - resolution: {integrity: sha512-a/ZAVmrD5yOfUYhRVfC9afMkczzL8J8zdf0h6QHbTd33rJW/jmjwTn++RTdnbSD2gg2fSBRi/h8y17RmqIdb9g==} - peerDependencies: - nuxt: ^3.8.1 - vite: '*' - dependencies: - '@nuxt/kit': 3.8.2(rollup@4.5.0) - '@nuxt/schema': 3.8.2(rollup@4.5.0) - execa: 7.2.0 - nuxt: 3.8.2(eslint@8.54.0)(rollup@4.5.0)(typescript@5.2.2)(vite@4.5.0) + nuxt: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0) vite: 4.5.0(@types/node@20.8.10) transitivePeerDependencies: - rollup @@ -1573,7 +1570,7 @@ packages: local-pkg: 0.5.0 magicast: 0.3.2 nitropack: 2.8.0 - nuxt: 3.8.2(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0) + nuxt: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0) nypm: 0.3.3 ofetch: 1.3.3 ohash: 1.1.3 @@ -1612,74 +1609,6 @@ packages: - supports-color - utf-8-validate - xml2js - dev: true - - /@nuxt/devtools@1.0.3(nuxt@3.8.2)(rollup@4.5.0)(vite@4.5.0): - resolution: {integrity: sha512-2mXvQiS3KTMF0fO80Y9WLx95yubRoIp2wSCarmhhqInPe8/0K9VZ4TUiTGF20ti45h0ky3OAxiVSmLfViwDWjg==} - hasBin: true - peerDependencies: - nuxt: ^3.8.1 - vite: '*' - dependencies: - '@antfu/utils': 0.7.6 - '@nuxt/devtools-kit': 1.0.3(nuxt@3.8.2)(rollup@4.5.0)(vite@4.5.0) - '@nuxt/devtools-wizard': 1.0.3 - '@nuxt/kit': 3.8.2(rollup@4.5.0) - birpc: 0.2.14 - consola: 3.2.3 - destr: 2.0.2 - error-stack-parser-es: 0.1.1 - execa: 7.2.0 - fast-glob: 3.3.2 - flatted: 3.2.9 - get-port-please: 3.1.1 - h3: 1.9.0 - hookable: 5.5.3 - image-meta: 0.2.0 - is-installed-globally: 1.0.0 - launch-editor: 2.6.1 - local-pkg: 0.5.0 - magicast: 0.3.2 - nitropack: 2.8.0 - nuxt: 3.8.2(eslint@8.54.0)(rollup@4.5.0)(typescript@5.2.2)(vite@4.5.0) - nypm: 0.3.3 - ofetch: 1.3.3 - ohash: 1.1.3 - pacote: 17.0.4 - pathe: 1.1.1 - perfect-debounce: 1.0.0 - pkg-types: 1.0.3 - rc9: 2.1.1 - scule: 1.1.0 - semver: 7.5.4 - simple-git: 3.21.0 - sirv: 2.0.3 - unimport: 3.5.0(rollup@4.5.0) - vite: 4.5.0(@types/node@20.8.10) - vite-plugin-inspect: 0.7.42(@nuxt/kit@3.8.2)(rollup@4.5.0)(vite@4.5.0) - vite-plugin-vue-inspector: 4.0.0(vite@4.5.0) - which: 3.0.1 - ws: 8.14.2 - transitivePeerDependencies: - - '@azure/app-configuration' - - '@azure/cosmos' - - '@azure/data-tables' - - '@azure/identity' - - '@azure/keyvault-secrets' - - '@azure/storage-blob' - - '@capacitor/preferences' - - '@netlify/blobs' - - '@planetscale/database' - - '@upstash/redis' - - '@vercel/kv' - - bluebird - - bufferutil - - encoding - - idb-keyval - - rollup - - supports-color - - utf-8-validate - - xml2js /@nuxt/eslint-config@0.2.0(eslint@8.54.0): resolution: {integrity: sha512-NeJX8TLcnNAjQFiDs3XhP+9CHKK8jaKsP7eUyCSrQdgY7nqWe7VJx64lwzx5FTT4cW3RHMEyH+Y0qzLGYYoa/A==} @@ -1722,32 +1651,6 @@ packages: - rollup - supports-color - /@nuxt/kit@3.8.2(rollup@4.5.0): - resolution: {integrity: sha512-LrXCm8hAkw+zpX8teUSD/LqXRarlXjbRiYxDkaqw739JSHFReWzBFgJbojsJqL4h1XIEScDGGOWiEgO4QO1sMg==} - engines: {node: ^14.18.0 || >=16.10.0} - dependencies: - '@nuxt/schema': 3.8.2(rollup@4.5.0) - c12: 1.5.1 - consola: 3.2.3 - defu: 6.1.3 - globby: 14.0.0 - hash-sum: 2.0.0 - ignore: 5.3.0 - jiti: 1.21.0 - knitwork: 1.0.0 - mlly: 1.4.2 - pathe: 1.1.1 - pkg-types: 1.0.3 - scule: 1.1.0 - semver: 7.5.4 - ufo: 1.3.2 - unctx: 2.3.1 - unimport: 3.5.0(rollup@4.5.0) - untyped: 1.4.0 - transitivePeerDependencies: - - rollup - - supports-color - /@nuxt/module-builder@0.5.3(@nuxt/kit@3.8.2)(nuxi@3.10.0)(typescript@5.2.2): resolution: {integrity: sha512-iKQHuZb8/IXzTW2CqrIlsmzBuSaM9vISTGM0+KxbBPSG5JCy5MtWbmxPIw1jgac1g/B2ZkBhOCXOxGTecCHTRQ==} hasBin: true @@ -1787,25 +1690,6 @@ packages: - rollup - supports-color - /@nuxt/schema@3.8.2(rollup@4.5.0): - resolution: {integrity: sha512-AMpysQ/wHK2sOujLShqYdC4OSj/S3fFJGjhYXqA2g6dgmz+FNQWJRG/ie5sI9r2EX9Ela1wt0GN1jZR3wYNE8Q==} - engines: {node: ^14.18.0 || >=16.10.0} - dependencies: - '@nuxt/ui-templates': 1.3.1 - consola: 3.2.3 - defu: 6.1.3 - hookable: 5.5.3 - pathe: 1.1.1 - pkg-types: 1.0.3 - scule: 1.1.0 - std-env: 3.5.0 - ufo: 1.3.2 - unimport: 3.5.0(rollup@4.5.0) - untyped: 1.4.0 - transitivePeerDependencies: - - rollup - - supports-color - /@nuxt/telemetry@2.5.2(rollup@3.29.4): resolution: {integrity: sha512-kZ+rWq/5MZonMhp8KGFI5zMaR2VsiWpnlkOLJIuIX2WoJl0DkHvtxCtuFq2erAqMVruWLpKU+tgMC+1cno/QmA==} hasBin: true @@ -1830,97 +1714,11 @@ packages: transitivePeerDependencies: - rollup - supports-color - dev: true - - /@nuxt/telemetry@2.5.2(rollup@4.5.0): - resolution: {integrity: sha512-kZ+rWq/5MZonMhp8KGFI5zMaR2VsiWpnlkOLJIuIX2WoJl0DkHvtxCtuFq2erAqMVruWLpKU+tgMC+1cno/QmA==} - hasBin: true - dependencies: - '@nuxt/kit': 3.8.2(rollup@4.5.0) - ci-info: 3.9.0 - consola: 3.2.3 - create-require: 1.1.1 - defu: 6.1.3 - destr: 2.0.2 - dotenv: 16.3.1 - git-url-parse: 13.1.1 - is-docker: 3.0.0 - jiti: 1.21.0 - mri: 1.2.0 - nanoid: 4.0.2 - ofetch: 1.3.3 - parse-git-config: 3.0.0 - pathe: 1.1.1 - rc9: 2.1.1 - std-env: 3.5.0 - transitivePeerDependencies: - - rollup - - supports-color /@nuxt/ui-templates@1.3.1: resolution: {integrity: sha512-5gc02Pu1HycOVUWJ8aYsWeeXcSTPe8iX8+KIrhyEtEoOSkY0eMBuo0ssljB8wALuEmepv31DlYe5gpiRwkjESA==} - /@nuxt/vite-builder@3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@4.5.0)(typescript@5.2.2)(vue@3.3.8): - resolution: {integrity: sha512-l/lzDDTbd3M89BpmWqjhVLgLVRqfkKp0tyYgV5seJQjj3SX+IeqI7k6k8+dMEifdeO34jUajVWptNpITXQryyg==} - engines: {node: ^14.18.0 || >=16.10.0} - peerDependencies: - vue: ^3.3.4 - dependencies: - '@nuxt/kit': 3.8.2(rollup@4.5.0) - '@rollup/plugin-replace': 5.0.5(rollup@4.5.0) - '@vitejs/plugin-vue': 4.5.0(vite@4.5.0)(vue@3.3.8) - '@vitejs/plugin-vue-jsx': 3.1.0(vite@4.5.0)(vue@3.3.8) - autoprefixer: 10.4.16(postcss@8.4.31) - clear: 0.1.0 - consola: 3.2.3 - cssnano: 6.0.1(postcss@8.4.31) - defu: 6.1.3 - esbuild: 0.19.7 - escape-string-regexp: 5.0.0 - estree-walker: 3.0.3 - externality: 1.0.2 - fs-extra: 11.1.1 - get-port-please: 3.1.1 - h3: 1.9.0 - knitwork: 1.0.0 - magic-string: 0.30.5 - mlly: 1.4.2 - ohash: 1.1.3 - pathe: 1.1.1 - perfect-debounce: 1.0.0 - pkg-types: 1.0.3 - postcss: 8.4.31 - rollup-plugin-visualizer: 5.9.2(rollup@4.5.0) - std-env: 3.5.0 - strip-literal: 1.3.0 - ufo: 1.3.2 - unplugin: 1.5.1 - vite: 4.5.0(@types/node@20.8.10) - vite-node: 0.33.0(@types/node@20.8.10) - vite-plugin-checker: 0.6.2(eslint@8.54.0)(typescript@5.2.2)(vite@4.5.0) - vue: 3.3.8(typescript@5.2.2) - vue-bundle-renderer: 2.0.0 - transitivePeerDependencies: - - '@types/node' - - eslint - - less - - lightningcss - - meow - - optionator - - rollup - - sass - - stylelint - - stylus - - sugarss - - supports-color - - terser - - typescript - - vls - - vti - - vue-tsc - dev: false - - /@nuxt/vite-builder@3.8.2(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vue@3.3.8): + /@nuxt/vite-builder@3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vue@3.3.8): resolution: {integrity: sha512-l/lzDDTbd3M89BpmWqjhVLgLVRqfkKp0tyYgV5seJQjj3SX+IeqI7k6k8+dMEifdeO34jUajVWptNpITXQryyg==} engines: {node: ^14.18.0 || >=16.10.0} peerDependencies: @@ -1978,66 +1776,6 @@ packages: - vls - vti - vue-tsc - dev: true - - /@nuxt/vite-builder@3.8.2(eslint@8.54.0)(rollup@4.5.0)(typescript@5.2.2)(vue@3.3.8): - resolution: {integrity: sha512-l/lzDDTbd3M89BpmWqjhVLgLVRqfkKp0tyYgV5seJQjj3SX+IeqI7k6k8+dMEifdeO34jUajVWptNpITXQryyg==} - engines: {node: ^14.18.0 || >=16.10.0} - peerDependencies: - vue: ^3.3.4 - dependencies: - '@nuxt/kit': 3.8.2(rollup@4.5.0) - '@rollup/plugin-replace': 5.0.5(rollup@4.5.0) - '@vitejs/plugin-vue': 4.5.0(vite@4.5.0)(vue@3.3.8) - '@vitejs/plugin-vue-jsx': 3.1.0(vite@4.5.0)(vue@3.3.8) - autoprefixer: 10.4.16(postcss@8.4.31) - clear: 0.1.0 - consola: 3.2.3 - cssnano: 6.0.1(postcss@8.4.31) - defu: 6.1.3 - esbuild: 0.19.7 - escape-string-regexp: 5.0.0 - estree-walker: 3.0.3 - externality: 1.0.2 - fs-extra: 11.1.1 - get-port-please: 3.1.1 - h3: 1.9.0 - knitwork: 1.0.0 - magic-string: 0.30.5 - mlly: 1.4.2 - ohash: 1.1.3 - pathe: 1.1.1 - perfect-debounce: 1.0.0 - pkg-types: 1.0.3 - postcss: 8.4.31 - rollup-plugin-visualizer: 5.9.2(rollup@4.5.0) - std-env: 3.5.0 - strip-literal: 1.3.0 - ufo: 1.3.2 - unplugin: 1.5.1 - vite: 4.5.0(@types/node@20.8.10) - vite-node: 0.33.0(@types/node@20.8.10) - vite-plugin-checker: 0.6.2(eslint@8.54.0)(typescript@5.2.2)(vite@4.5.0) - vue: 3.3.8(typescript@5.2.2) - vue-bundle-renderer: 2.0.0 - transitivePeerDependencies: - - '@types/node' - - eslint - - less - - lightningcss - - meow - - optionator - - rollup - - sass - - stylelint - - stylus - - sugarss - - supports-color - - terser - - typescript - - vls - - vti - - vue-tsc /@one-ini/wasm@0.1.1: resolution: {integrity: sha512-XuySG1E38YScSJoMlqovLru4KTUNSjgVTIjyh7qMX6aNN5HY5Ct5LhRJdxO79JtTzKfzV/bnWpz+zquYrISsvw==} @@ -2121,6 +1859,7 @@ packages: dependencies: is-glob: 4.0.3 micromatch: 4.0.5 + napi-wasm: 1.1.0 bundledDependencies: - napi-wasm @@ -2325,7 +2064,6 @@ packages: '@rollup/pluginutils': 5.0.5(rollup@3.29.4) magic-string: 0.30.5 rollup: 3.29.4 - dev: true /@rollup/plugin-replace@5.0.5(rollup@4.5.0): resolution: {integrity: sha512-rYO4fOi8lMaTg/z5Jb+hKnrHHVn8j2lwkqwyS4kTRhKyWOLf2wST2sWXr4WzWiTcoHTp2sTjqUbqIj2E39slKQ==} @@ -2924,22 +2662,6 @@ packages: transitivePeerDependencies: - supports-color - /@vitejs/plugin-vue-jsx@3.1.0(vite@5.0.0)(vue@3.3.8): - resolution: {integrity: sha512-w9M6F3LSEU5kszVb9An2/MmXNxocAnUb3WhRr8bHlimhDrXNt6n6D2nJQR3UXpGlZHh/EsgouOHCsM8V3Ln+WA==} - engines: {node: ^14.18.0 || >=16.0.0} - peerDependencies: - vite: ^4.0.0 || ^5.0.0 - vue: ^3.0.0 - dependencies: - '@babel/core': 7.23.3 - '@babel/plugin-transform-typescript': 7.23.4(@babel/core@7.23.3) - '@vue/babel-plugin-jsx': 1.1.5(@babel/core@7.23.3) - vite: 5.0.0 - vue: 3.3.8(typescript@5.2.2) - transitivePeerDependencies: - - supports-color - dev: true - /@vitejs/plugin-vue@4.5.0(vite@4.5.0)(vue@3.3.8): resolution: {integrity: sha512-a2WSpP8X8HTEww/U00bU4mX1QpLINNuz/2KMNpLsdu3BzOpak3AGI1CJYBTXcc4SPhaD0eNRUp7IyQK405L5dQ==} engines: {node: ^14.18.0 || >=16.0.0} @@ -2950,17 +2672,6 @@ packages: vite: 4.5.0(@types/node@20.8.10) vue: 3.3.8(typescript@5.2.2) - /@vitejs/plugin-vue@4.5.0(vite@5.0.0)(vue@3.3.8): - resolution: {integrity: sha512-a2WSpP8X8HTEww/U00bU4mX1QpLINNuz/2KMNpLsdu3BzOpak3AGI1CJYBTXcc4SPhaD0eNRUp7IyQK405L5dQ==} - engines: {node: ^14.18.0 || >=16.0.0} - peerDependencies: - vite: ^4.0.0 || ^5.0.0 - vue: ^3.2.25 - dependencies: - vite: 5.0.0 - vue: 3.3.8(typescript@5.2.2) - dev: true - /@vitest/expect@0.33.0: resolution: {integrity: sha512-sVNf+Gla3mhTCxNJx+wJLDPp/WcstOe0Ksqz4Vec51MmgMth/ia0MGFEkIZmVGeTL5HtjYR4Wl/ZxBxBXZJTzQ==} dependencies: @@ -3017,26 +2728,6 @@ packages: vue: 3.3.8(typescript@5.2.2) transitivePeerDependencies: - rollup - dev: true - - /@vue-macros/common@1.8.0(rollup@4.5.0)(vue@3.3.8): - resolution: {integrity: sha512-auDJJzE0z3uRe3867e0DsqcseKImktNf5ojCZgUKqiVxb2yTlwlgOVAYCgoep9oITqxkXQymSvFeKhedi8PhaA==} - engines: {node: '>=16.14.0'} - peerDependencies: - vue: ^2.7.0 || ^3.2.25 - peerDependenciesMeta: - vue: - optional: true - dependencies: - '@babel/types': 7.23.4 - '@rollup/pluginutils': 5.0.5(rollup@4.5.0) - '@vue/compiler-sfc': 3.3.8 - ast-kit: 0.11.2(rollup@4.5.0) - local-pkg: 0.4.3 - magic-string-ast: 0.3.0 - vue: 3.3.8(typescript@5.2.2) - transitivePeerDependencies: - - rollup /@vue/babel-helper-vue-transform-on@1.1.5: resolution: {integrity: sha512-SgUymFpMoAyWeYWLAY+MkCK3QEROsiUnfaw5zxOVD/M64KQs8D/4oK6Q5omVA2hnvEOE0SCkH2TZxs/jnnUj7w==} @@ -3393,17 +3084,6 @@ packages: pathe: 1.1.1 transitivePeerDependencies: - rollup - dev: true - - /ast-kit@0.11.2(rollup@4.5.0): - resolution: {integrity: sha512-Q0DjXK4ApbVoIf9GLyCo252tUH44iTnD/hiJ2TQaJeydYWSpKk0sI34+WMel8S9Wt5pbLgG02oJ+gkgX5DV3sQ==} - engines: {node: '>=16.14.0'} - dependencies: - '@babel/parser': 7.23.4 - '@rollup/pluginutils': 5.0.5(rollup@4.5.0) - pathe: 1.1.1 - transitivePeerDependencies: - - rollup /ast-kit@0.9.5(rollup@3.29.4): resolution: {integrity: sha512-kbL7ERlqjXubdDd+szuwdlQ1xUxEz9mCz1+m07ftNVStgwRb2RWw+U6oKo08PAvOishMxiqz1mlJyLl8yQx2Qg==} @@ -3414,17 +3094,6 @@ packages: pathe: 1.1.1 transitivePeerDependencies: - rollup - dev: true - - /ast-kit@0.9.5(rollup@4.5.0): - resolution: {integrity: sha512-kbL7ERlqjXubdDd+szuwdlQ1xUxEz9mCz1+m07ftNVStgwRb2RWw+U6oKo08PAvOishMxiqz1mlJyLl8yQx2Qg==} - engines: {node: '>=16.14.0'} - dependencies: - '@babel/parser': 7.23.4 - '@rollup/pluginutils': 5.0.5(rollup@4.5.0) - pathe: 1.1.1 - transitivePeerDependencies: - - rollup /ast-walker-scope@0.5.0(rollup@3.29.4): resolution: {integrity: sha512-NsyHMxBh4dmdEHjBo1/TBZvCKxffmZxRYhmclfu0PP6Aftre47jOHYaYaNqJcV0bxihxFXhDkzLHUwHc0ocd0Q==} @@ -3434,16 +3103,6 @@ packages: ast-kit: 0.9.5(rollup@3.29.4) transitivePeerDependencies: - rollup - dev: true - - /ast-walker-scope@0.5.0(rollup@4.5.0): - resolution: {integrity: sha512-NsyHMxBh4dmdEHjBo1/TBZvCKxffmZxRYhmclfu0PP6Aftre47jOHYaYaNqJcV0bxihxFXhDkzLHUwHc0ocd0Q==} - engines: {node: '>=16.14.0'} - dependencies: - '@babel/parser': 7.23.4 - ast-kit: 0.9.5(rollup@4.5.0) - transitivePeerDependencies: - - rollup /async-sema@3.1.1: resolution: {integrity: sha512-tLRNUXati5MFePdAk8dw7Qt7DpxPB60ofAgn8WRhW6a2rcimZnYBP9oxHiv0OHy+Wz7kPMG+t4LGdt31+4EmGg==} @@ -6789,6 +6448,9 @@ packages: engines: {node: ^14 || ^16 || >=18} hasBin: true + /napi-wasm@1.1.0: + resolution: {integrity: sha512-lHwIAJbmLSjF9VDRm9GoVOy9AGp3aIvkjv+Kvz9h16QR3uSVYH78PNQUnT2U4X53mhlnV2M7wrhibQ3GHicDmg==} + /natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} @@ -7024,158 +6686,52 @@ packages: semver: 7.5.4 /npm-registry-fetch@16.1.0: - resolution: {integrity: sha512-PQCELXKt8Azvxnt5Y85GseQDJJlglTFM9L9U9gkv2y4e9s0k3GVDdOx3YoB6gm2Do0hlkzC39iCGXby+Wve1Bw==} - engines: {node: ^16.14.0 || >=18.0.0} - dependencies: - make-fetch-happen: 13.0.0 - minipass: 7.0.4 - minipass-fetch: 3.0.4 - minipass-json-stream: 1.0.1 - minizlib: 2.1.2 - npm-package-arg: 11.0.1 - proc-log: 3.0.0 - transitivePeerDependencies: - - supports-color - - /npm-run-path@4.0.1: - resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} - engines: {node: '>=8'} - dependencies: - path-key: 3.1.1 - - /npm-run-path@5.1.0: - resolution: {integrity: sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - path-key: 4.0.0 - - /npmlog@5.0.1: - resolution: {integrity: sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==} - dependencies: - are-we-there-yet: 2.0.0 - console-control-strings: 1.1.0 - gauge: 3.0.2 - set-blocking: 2.0.0 - - /nth-check@2.1.1: - resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==} - dependencies: - boolbase: 1.0.0 - - /nuxi@3.10.0: - resolution: {integrity: sha512-veZXw2NuaQ1PrpvHrnQ1dPgkAjv0WqPlvFReg5Iubum0QVGWdJJvGuNsltDQyPcZ7X7mhMXq9SLIpokK4kpvKA==} - engines: {node: ^14.18.0 || >=16.10.0} - hasBin: true - optionalDependencies: - fsevents: 2.3.3 - - /nuxt@3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@4.5.0)(typescript@5.2.2)(vite@4.5.0): - resolution: {integrity: sha512-HUAyifmqTs2zcQBGvcby3KNs2pBAk+l7ZbLjD1oCNqQQ+wBuZ1qgLC4Ebu++y4g3o3Y8WAWSvpafbKRLQZziPw==} - engines: {node: ^14.18.0 || >=16.10.0} - hasBin: true - peerDependencies: - '@parcel/watcher': ^2.1.0 - '@types/node': ^14.18.0 || >=16.10.0 - peerDependenciesMeta: - '@parcel/watcher': - optional: true - '@types/node': - optional: true - dependencies: - '@nuxt/devalue': 2.0.2 - '@nuxt/devtools': 1.0.3(nuxt@3.8.2)(rollup@4.5.0)(vite@4.5.0) - '@nuxt/kit': 3.8.2(rollup@4.5.0) - '@nuxt/schema': 3.8.2(rollup@4.5.0) - '@nuxt/telemetry': 2.5.2(rollup@4.5.0) - '@nuxt/ui-templates': 1.3.1 - '@nuxt/vite-builder': 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@4.5.0)(typescript@5.2.2)(vue@3.3.8) - '@types/node': 20.8.10 - '@unhead/dom': 1.8.5 - '@unhead/ssr': 1.8.5 - '@unhead/vue': 1.8.5(vue@3.3.8) - '@vue/shared': 3.3.8 - acorn: 8.11.2 - c12: 1.5.1 - chokidar: 3.5.3 - cookie-es: 1.0.0 - defu: 6.1.3 - destr: 2.0.2 - devalue: 4.3.2 - esbuild: 0.19.7 - escape-string-regexp: 5.0.0 - estree-walker: 3.0.3 - fs-extra: 11.1.1 - globby: 14.0.0 - h3: 1.9.0 - hookable: 5.5.3 - jiti: 1.21.0 - klona: 2.0.6 - knitwork: 1.0.0 - magic-string: 0.30.5 - mlly: 1.4.2 - nitropack: 2.8.0 - nuxi: 3.10.0 - nypm: 0.3.3 - ofetch: 1.3.3 - ohash: 1.1.3 - pathe: 1.1.1 - perfect-debounce: 1.0.0 - pkg-types: 1.0.3 - radix3: 1.1.0 - scule: 1.1.0 - std-env: 3.5.0 - strip-literal: 1.3.0 - ufo: 1.3.2 - ultrahtml: 1.5.2 - uncrypto: 0.1.3 - unctx: 2.3.1 - unenv: 1.7.4 - unimport: 3.5.0(rollup@4.5.0) - unplugin: 1.5.1 - unplugin-vue-router: 0.7.0(rollup@4.5.0)(vue-router@4.2.5)(vue@3.3.8) - untyped: 1.4.0 - vue: 3.3.8(typescript@5.2.2) - vue-bundle-renderer: 2.0.0 - vue-devtools-stub: 0.1.0 - vue-router: 4.2.5(vue@3.3.8) + resolution: {integrity: sha512-PQCELXKt8Azvxnt5Y85GseQDJJlglTFM9L9U9gkv2y4e9s0k3GVDdOx3YoB6gm2Do0hlkzC39iCGXby+Wve1Bw==} + engines: {node: ^16.14.0 || >=18.0.0} + dependencies: + make-fetch-happen: 13.0.0 + minipass: 7.0.4 + minipass-fetch: 3.0.4 + minipass-json-stream: 1.0.1 + minizlib: 2.1.2 + npm-package-arg: 11.0.1 + proc-log: 3.0.0 transitivePeerDependencies: - - '@azure/app-configuration' - - '@azure/cosmos' - - '@azure/data-tables' - - '@azure/identity' - - '@azure/keyvault-secrets' - - '@azure/storage-blob' - - '@capacitor/preferences' - - '@netlify/blobs' - - '@planetscale/database' - - '@upstash/redis' - - '@vercel/kv' - - bluebird - - bufferutil - - encoding - - eslint - - idb-keyval - - less - - lightningcss - - meow - - optionator - - rollup - - sass - - stylelint - - stylus - - sugarss - supports-color - - terser - - typescript - - utf-8-validate - - vite - - vls - - vti - - vue-tsc - - xml2js - dev: false - /nuxt@3.8.2(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0): + /npm-run-path@4.0.1: + resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} + engines: {node: '>=8'} + dependencies: + path-key: 3.1.1 + + /npm-run-path@5.1.0: + resolution: {integrity: sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + path-key: 4.0.0 + + /npmlog@5.0.1: + resolution: {integrity: sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==} + dependencies: + are-we-there-yet: 2.0.0 + console-control-strings: 1.1.0 + gauge: 3.0.2 + set-blocking: 2.0.0 + + /nth-check@2.1.1: + resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==} + dependencies: + boolbase: 1.0.0 + + /nuxi@3.10.0: + resolution: {integrity: sha512-veZXw2NuaQ1PrpvHrnQ1dPgkAjv0WqPlvFReg5Iubum0QVGWdJJvGuNsltDQyPcZ7X7mhMXq9SLIpokK4kpvKA==} + engines: {node: ^14.18.0 || >=16.10.0} + hasBin: true + optionalDependencies: + fsevents: 2.3.3 + + /nuxt@3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0): resolution: {integrity: sha512-HUAyifmqTs2zcQBGvcby3KNs2pBAk+l7ZbLjD1oCNqQQ+wBuZ1qgLC4Ebu++y4g3o3Y8WAWSvpafbKRLQZziPw==} engines: {node: ^14.18.0 || >=16.10.0} hasBin: true @@ -7194,7 +6750,8 @@ packages: '@nuxt/schema': 3.8.2(rollup@3.29.4) '@nuxt/telemetry': 2.5.2(rollup@3.29.4) '@nuxt/ui-templates': 1.3.1 - '@nuxt/vite-builder': 3.8.2(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vue@3.3.8) + '@nuxt/vite-builder': 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vue@3.3.8) + '@types/node': 20.8.10 '@unhead/dom': 1.8.5 '@unhead/ssr': 1.8.5 '@unhead/vue': 1.8.5(vue@3.3.8) @@ -7278,111 +6835,6 @@ packages: - vti - vue-tsc - xml2js - dev: true - - /nuxt@3.8.2(eslint@8.54.0)(rollup@4.5.0)(typescript@5.2.2)(vite@4.5.0): - resolution: {integrity: sha512-HUAyifmqTs2zcQBGvcby3KNs2pBAk+l7ZbLjD1oCNqQQ+wBuZ1qgLC4Ebu++y4g3o3Y8WAWSvpafbKRLQZziPw==} - engines: {node: ^14.18.0 || >=16.10.0} - hasBin: true - peerDependencies: - '@parcel/watcher': ^2.1.0 - '@types/node': ^14.18.0 || >=16.10.0 - peerDependenciesMeta: - '@parcel/watcher': - optional: true - '@types/node': - optional: true - dependencies: - '@nuxt/devalue': 2.0.2 - '@nuxt/devtools': 1.0.3(nuxt@3.8.2)(rollup@4.5.0)(vite@4.5.0) - '@nuxt/kit': 3.8.2(rollup@4.5.0) - '@nuxt/schema': 3.8.2(rollup@4.5.0) - '@nuxt/telemetry': 2.5.2(rollup@4.5.0) - '@nuxt/ui-templates': 1.3.1 - '@nuxt/vite-builder': 3.8.2(eslint@8.54.0)(rollup@4.5.0)(typescript@5.2.2)(vue@3.3.8) - '@unhead/dom': 1.8.5 - '@unhead/ssr': 1.8.5 - '@unhead/vue': 1.8.5(vue@3.3.8) - '@vue/shared': 3.3.8 - acorn: 8.11.2 - c12: 1.5.1 - chokidar: 3.5.3 - cookie-es: 1.0.0 - defu: 6.1.3 - destr: 2.0.2 - devalue: 4.3.2 - esbuild: 0.19.7 - escape-string-regexp: 5.0.0 - estree-walker: 3.0.3 - fs-extra: 11.1.1 - globby: 14.0.0 - h3: 1.9.0 - hookable: 5.5.3 - jiti: 1.21.0 - klona: 2.0.6 - knitwork: 1.0.0 - magic-string: 0.30.5 - mlly: 1.4.2 - nitropack: 2.8.0 - nuxi: 3.10.0 - nypm: 0.3.3 - ofetch: 1.3.3 - ohash: 1.1.3 - pathe: 1.1.1 - perfect-debounce: 1.0.0 - pkg-types: 1.0.3 - radix3: 1.1.0 - scule: 1.1.0 - std-env: 3.5.0 - strip-literal: 1.3.0 - ufo: 1.3.2 - ultrahtml: 1.5.2 - uncrypto: 0.1.3 - unctx: 2.3.1 - unenv: 1.7.4 - unimport: 3.5.0(rollup@4.5.0) - unplugin: 1.5.1 - unplugin-vue-router: 0.7.0(rollup@4.5.0)(vue-router@4.2.5)(vue@3.3.8) - untyped: 1.4.0 - vue: 3.3.8(typescript@5.2.2) - vue-bundle-renderer: 2.0.0 - vue-devtools-stub: 0.1.0 - vue-router: 4.2.5(vue@3.3.8) - transitivePeerDependencies: - - '@azure/app-configuration' - - '@azure/cosmos' - - '@azure/data-tables' - - '@azure/identity' - - '@azure/keyvault-secrets' - - '@azure/storage-blob' - - '@capacitor/preferences' - - '@netlify/blobs' - - '@planetscale/database' - - '@upstash/redis' - - '@vercel/kv' - - bluebird - - bufferutil - - encoding - - eslint - - idb-keyval - - less - - lightningcss - - meow - - optionator - - rollup - - sass - - stylelint - - stylus - - sugarss - - supports-color - - terser - - typescript - - utf-8-validate - - vite - - vls - - vti - - vue-tsc - - xml2js /nwsapi@2.2.7: resolution: {integrity: sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==} @@ -8288,7 +7740,6 @@ packages: rollup: 3.29.4 source-map: 0.7.4 yargs: 17.7.2 - dev: true /rollup-plugin-visualizer@5.9.2(rollup@4.5.0): resolution: {integrity: sha512-waHktD5mlWrYFrhOLbti4YgQCn1uR24nYsNuXxg7LkPH8KdTXVWR9DNY1WU0QqokyMixVXJS4J04HNrVTMP01A==} @@ -9259,33 +8710,6 @@ packages: transitivePeerDependencies: - rollup - vue - dev: true - - /unplugin-vue-router@0.7.0(rollup@4.5.0)(vue-router@4.2.5)(vue@3.3.8): - resolution: {integrity: sha512-ddRreGq0t5vlSB7OMy4e4cfU1w2AwBQCwmvW3oP/0IHQiokzbx4hd3TpwBu3eIAFVuhX2cwNQwp1U32UybTVCw==} - peerDependencies: - vue-router: ^4.1.0 - peerDependenciesMeta: - vue-router: - optional: true - dependencies: - '@babel/types': 7.23.4 - '@rollup/pluginutils': 5.0.5(rollup@4.5.0) - '@vue-macros/common': 1.8.0(rollup@4.5.0)(vue@3.3.8) - ast-walker-scope: 0.5.0(rollup@4.5.0) - chokidar: 3.5.3 - fast-glob: 3.3.2 - json5: 2.2.3 - local-pkg: 0.4.3 - mlly: 1.4.2 - pathe: 1.1.1 - scule: 1.1.0 - unplugin: 1.5.1 - vue-router: 4.2.5(vue@3.3.8) - yaml: 2.3.4 - transitivePeerDependencies: - - rollup - - vue /unplugin@1.5.1: resolution: {integrity: sha512-0QkvG13z6RD+1L1FoibQqnvTwVBXvS4XSPwAyinVgoOCl2jAgwzdUKmEj05o4Lt8xwQI85Hb6mSyYkcAGwZPew==} @@ -9527,31 +8951,6 @@ packages: transitivePeerDependencies: - rollup - supports-color - dev: true - - /vite-plugin-inspect@0.7.42(@nuxt/kit@3.8.2)(rollup@4.5.0)(vite@4.5.0): - resolution: {integrity: sha512-JCyX86wr3siQc+p9Kd0t8VkFHAJag0RaQVIpdFGSv5FEaePEVB6+V/RGtz2dQkkGSXQzRWrPs4cU3dRKg32bXw==} - engines: {node: '>=14'} - peerDependencies: - '@nuxt/kit': '*' - vite: ^3.1.0 || ^4.0.0 || ^5.0.0-0 - peerDependenciesMeta: - '@nuxt/kit': - optional: true - dependencies: - '@antfu/utils': 0.7.6 - '@nuxt/kit': 3.8.2(rollup@4.5.0) - '@rollup/pluginutils': 5.0.5(rollup@4.5.0) - debug: 4.3.4 - error-stack-parser-es: 0.1.1 - fs-extra: 11.1.1 - open: 9.1.0 - picocolors: 1.0.0 - sirv: 2.0.3 - vite: 4.5.0(@types/node@20.8.10) - transitivePeerDependencies: - - rollup - - supports-color /vite-plugin-vue-inspector@4.0.0(vite@4.5.0): resolution: {integrity: sha512-xNjMbRj3YrebuuInTvlC8ghPtzT+3LjMIQPeeR/5CaFd+WcbA9wBnECZmlcP3GITCVED0SxGmTyoJ3iVKsK4vQ==} @@ -9606,41 +9005,6 @@ packages: optionalDependencies: fsevents: 2.3.3 - /vite@5.0.0: - resolution: {integrity: sha512-ESJVM59mdyGpsiNAeHQOR/0fqNoOyWPYesFto8FFZugfmhdHx8Fzd8sF3Q/xkVhZsyOxHfdM7ieiVAorI9RjFw==} - engines: {node: ^18.0.0 || >=20.0.0} - hasBin: true - peerDependencies: - '@types/node': ^18.0.0 || >=20.0.0 - less: '*' - lightningcss: ^1.21.0 - sass: '*' - stylus: '*' - sugarss: '*' - terser: ^5.4.0 - peerDependenciesMeta: - '@types/node': - optional: true - less: - optional: true - lightningcss: - optional: true - sass: - optional: true - stylus: - optional: true - sugarss: - optional: true - terser: - optional: true - dependencies: - esbuild: 0.19.7 - postcss: 8.4.31 - rollup: 4.5.0 - optionalDependencies: - fsevents: 2.3.3 - dev: true - /vitest@0.33.0(happy-dom@12.10.3)(jsdom@22.1.0): resolution: {integrity: sha512-1CxaugJ50xskkQ0e969R/hW47za4YXDUfWJDxip1hwbnhUjYolpfUn2AMOulqG/Dtd9WYAtkHmM/m3yKVrEejQ==} engines: {node: '>=v14.18.0'} @@ -10008,3 +9372,8 @@ packages: archiver-utils: 4.0.1 compress-commons: 5.0.1 readable-stream: 3.6.2 + + file:stubs/vitest-environment-nuxt: + resolution: {directory: stubs/vitest-environment-nuxt, type: directory} + name: vitest-environment-nuxt + dev: true diff --git a/src/module.ts b/src/module.ts index fc95edde8..efa26d351 100644 --- a/src/module.ts +++ b/src/module.ts @@ -1 +1 @@ -export { default } from 'nuxt-vitest/module' +export { default } from './nuxt-vitest/module' diff --git a/src/nuxt-vitest/config.ts b/src/nuxt-vitest/config.ts index 2723612af..ea5bd8b04 100644 --- a/src/nuxt-vitest/config.ts +++ b/src/nuxt-vitest/config.ts @@ -31,7 +31,7 @@ async function startNuxtAndGetViteConfig( }) if ( - !nuxt.options._installedModules.find(i => i?.meta?.name === '@nuxt/test-utils/module') + !nuxt.options._installedModules.find(i => i?.meta?.name === '@nuxt/test-utils') ) { throw new Error( 'Failed to load nuxt-vitest module. You may need to add it to your nuxt.config.' @@ -139,6 +139,7 @@ export async function getVitestConfigFromNuxt( /\/node_modules\/(.*\/)?(nuxt|nuxt3)\//, /^#/, // additional deps + '@nuxt/test-utils', 'vitest-environment-nuxt', ...(options.nuxt.options.build.transpile.filter( r => typeof r === 'string' || r instanceof RegExp diff --git a/src/nuxt-vitest/mock-module.ts b/src/nuxt-vitest/mock-module.ts new file mode 100644 index 000000000..f7148f013 --- /dev/null +++ b/src/nuxt-vitest/mock-module.ts @@ -0,0 +1,325 @@ +import type { Import, Unimport } from 'unimport' +import { addVitePlugin, useNuxt } from '@nuxt/kit' +import { walk } from 'estree-walker' +import type { CallExpression } from 'estree' +import type { AcornNode } from 'rollup' +import MagicString from 'magic-string' +import type { Component } from '@nuxt/schema' +import type { Plugin } from 'vite' +import { normalize, resolve } from 'node:path' + +const PLUGIN_NAME = 'nuxt:vitest:mock-transform' + +const HELPER_MOCK_IMPORT = 'mockNuxtImport' +const HELPER_MOCK_COMPONENT = 'mockComponent' +const HELPER_MOCK_HOIST = '__NUXT_VITEST_MOCKS' + +const HELPERS_NAME = [HELPER_MOCK_IMPORT, HELPER_MOCK_COMPONENT] + +export interface MockImportInfo { + name: string + import: Import + factory: string +} + +export interface MockComponentInfo { + path: string + factory: string +} + +/** + * This module is a macro that transforms `mockNuxtImport()` to `vi.mock()`, + * which make it possible to mock Nuxt imports. + */ +export function setupImportMocking () { + const nuxt = useNuxt() + + let importsCtx: Unimport + let imports: Import[] = [] + let components: Component[] = [] + + nuxt.hook('imports:context', async ctx => { + importsCtx = ctx + }) + nuxt.hook('components:extend', _ => { + components = _ + }) + nuxt.hook('ready', async () => { + imports = await importsCtx.getImports() + }) + + // Polyfill Array.prototype.findLastIndex for legacy Node.js + function findLastIndex(arr: T[], predicate: (item: T) => boolean) { + for (let i = arr.length - 1; i >= 0; i--) { + if (predicate(arr[i])) return i + } + return -1 + } + + // path of the first vitest setup file to be ran + let resolvedFirstSetupFile: null | string = null + addVitePlugin({ + name: PLUGIN_NAME, + enforce: 'post', + // Place Vitest's mock plugin after all Nuxt plugins + configResolved(config) { + const firstSetupFile = Array.isArray(config.test?.setupFiles) + ? config.test!.setupFiles[0] + : config.test?.setupFiles + + if (firstSetupFile) { + resolvedFirstSetupFile = normalize(resolve(firstSetupFile)) + } + + const plugins = (config.plugins || []) as Plugin[] + // `vite:mocks` was a typo in Vitest before v0.34.0 + const mockPluginIndex = plugins.findIndex( + i => i.name === 'vite:mocks' || i.name === 'vitest:mocks' + ) + const lastNuxt = findLastIndex( + plugins, + i => i.name?.startsWith('nuxt:') + ) + if (mockPluginIndex !== -1 && lastNuxt !== -1) { + if (mockPluginIndex < lastNuxt) { + const [mockPlugin] = plugins.splice(mockPluginIndex, 1) + plugins.splice(lastNuxt, 0, mockPlugin) + } + } + }, + transform: { + handler(code, id) { + const isFirstSetupFile = normalize(id) === resolvedFirstSetupFile + const shouldPrependMockHoist = resolvedFirstSetupFile + ? isFirstSetupFile + : true + + if (!HELPERS_NAME.some(n => code.includes(n))) return + if (id.includes('/node_modules/')) return + + let ast: AcornNode + try { + ast = this.parse(code, { + sourceType: 'module', + ecmaVersion: 'latest', + ranges: true, + }) + } catch (e) { + return + } + + let insertionPoint = 0 + let hasViImport = false + + const s = new MagicString(code) + const mocksImport: MockImportInfo[] = [] + const mocksComponent: MockComponentInfo[] = [] + const importPathsList: Set = new Set() + + walk(ast as any, { + enter: (node, parent) => { + // find existing vi import + if (node.type === 'ImportDeclaration') { + if (node.source.value === 'vitest' && !hasViImport) { + if ( + node.specifiers.find( + i => + i.type === 'ImportSpecifier' && i.imported.name === 'vi' + ) + ) { + insertionPoint = node.range![1] + hasViImport = true + } + return + } + } + + if (node.type !== 'CallExpression') return + const call = node as CallExpression + // mockNuxtImport + if ( + call.callee.type === 'Identifier' && + call.callee.name === HELPER_MOCK_IMPORT + ) { + if (call.arguments.length !== 2) { + return this.error( + new Error( + `${HELPER_MOCK_IMPORT}() should have exactly 2 arguments` + ), + call.range![0] + ) + } + if (call.arguments[0].type !== 'Literal') { + return this.error( + new Error( + `The first argument of ${HELPER_MOCK_IMPORT}() must be a string literal` + ), + call.arguments[0].range![0] + ) + } + const name = call.arguments[0].value as string + const importItem = imports.find(_ => name === (_.as || _.name)) + if (!importItem) { + console.log({ imports }) + return this.error(`Cannot find import "${name}" to mock`) + } + + s.overwrite( + parent?.type === 'ExpressionStatement' + ? parent.range![0] + : call.arguments[0].range![0], + parent?.type === 'ExpressionStatement' + ? parent.range![1] + : call.arguments[1].range![1], + '' + ) + mocksImport.push({ + name, + import: importItem, + factory: code.slice( + call.arguments[1].range![0], + call.arguments[1].range![1] + ), + }) + } + // mockComponent + if ( + call.callee.type === 'Identifier' && + call.callee.name === HELPER_MOCK_COMPONENT + ) { + if (call.arguments.length !== 2) { + return this.error( + new Error( + `${HELPER_MOCK_COMPONENT}() should have exactly 2 arguments` + ), + call.range![0] + ) + } + if (call.arguments[0].type !== 'Literal') { + return this.error( + new Error( + `The first argument of ${HELPER_MOCK_COMPONENT}() must be a string literal` + ), + call.arguments[0].range![0] + ) + } + const pathOrName = call.arguments[0].value as string + const component = components.find( + _ => _.pascalName === pathOrName || _.kebabName === pathOrName + ) + const path = component?.filePath || pathOrName + + s.overwrite( + parent?.type === 'ExpressionStatement' + ? parent.range![0] + : call.arguments[1].range![0], + parent?.type === 'ExpressionStatement' + ? parent.range![1] + : call.arguments[1].range![1], + '' + ) + mocksComponent.push({ + path: path, + factory: code.slice( + call.arguments[1].range![0], + call.arguments[1].range![1] + ), + }) + } + }, + }) + + if (mocksImport.length === 0 && mocksComponent.length === 0) return + + const mockLines = [] + + if (mocksImport.length) { + const mockImportMap = new Map() + for (const mock of mocksImport) { + if (!mockImportMap.has(mock.import.from)) { + mockImportMap.set(mock.import.from, []) + } + mockImportMap.get(mock.import.from)!.push(mock) + } + mockLines.push( + ...Array.from(mockImportMap.entries()).flatMap( + ([from, mocks]) => { + importPathsList.add(from) + const lines = [ + `vi.mock(${JSON.stringify( + from + )}, async (importOriginal) => {`, + ` const mocks = global.${HELPER_MOCK_HOIST}`, + ` if (!mocks[${JSON.stringify( + from + )}]) { mocks[${JSON.stringify( + from + )}] = { ...await importOriginal(${JSON.stringify( + from + )}) } }`, + ] + for (const mock of mocks) { + if (mock.import.name === 'default') { + lines.push( + ` mocks[${JSON.stringify(from)}]["default"] = await (${ + mock.factory + })()` + ) + } else { + lines.push( + ` mocks[${JSON.stringify(from)}][${JSON.stringify( + mock.name + )}] = await (${mock.factory})()` + ) + } + } + lines.push(` return mocks[${JSON.stringify(from)}] `) + lines.push(`})`) + return lines + } + ) + ) + } + + if (mocksComponent.length) { + mockLines.push( + ...mocksComponent.flatMap(mock => { + return [ + `vi.mock(${JSON.stringify(mock.path)}, async () => {`, + ` const factory = (${mock.factory});`, + ` const result = typeof factory === 'function' ? await factory() : await factory`, + ` return 'default' in result ? result : { default: result }`, + '})', + ] + }) + ) + } + + if (!mockLines.length) return + + s.prepend(`vi.hoisted(() => { + if(!global.${HELPER_MOCK_HOIST}){ + vi.stubGlobal(${JSON.stringify(HELPER_MOCK_HOIST)}, {}) + } + });\n`) + + if (!hasViImport) s.prepend(`import {vi} from "vitest";\n`) + + s.appendLeft(insertionPoint, mockLines.join('\n') + '\n') + + // do an import to trick vite to keep it + // if not, the module won't be mocked + if (shouldPrependMockHoist) { + importPathsList.forEach(p => { + s.append(`\n import ${JSON.stringify(p)};`) + }) + } + + return { + code: s.toString(), + map: s.generateMap(), + } + }, + }, + }) +} diff --git a/src/nuxt-vitest/module.ts b/src/nuxt-vitest/module.ts index b6dd25c63..aa68962a5 100644 --- a/src/nuxt-vitest/module.ts +++ b/src/nuxt-vitest/module.ts @@ -1,5 +1,5 @@ import { pathToFileURL } from 'node:url' -import { defineNuxtModule, installModule, logger, resolvePath } from '@nuxt/kit' +import { defineNuxtModule, logger, resolvePath } from '@nuxt/kit' import type { File, Reporter, Vitest, UserConfig as VitestConfig } from 'vitest' import { mergeConfig } from 'vite' import type { InlineConfig as ViteConfig } from 'vite' @@ -9,6 +9,8 @@ import { h } from 'vue' import { debounce } from 'perfect-debounce' import { isCI } from 'std-env' +import { setupImportMocking } from './mock-module' + export interface NuxtVitestOptions { startOnBoot?: boolean logToConsole?: boolean @@ -31,10 +33,10 @@ export default defineNuxtModule({ logToConsole: false, }, async setup(options, nuxt) { - await installModule('vitest-environment-nuxt/module') - if (!nuxt.options.dev) return + setupImportMocking() + if (nuxt.options.test && nuxt.options.app.rootId === '__nuxt') { nuxt.options.app.rootId = 'nuxt-test' } @@ -59,6 +61,7 @@ export default defineNuxtModule({ let testFiles: File[] | null = null const updateTabs = debounce(() => { + // @ts-expect-error TODO: fix nuxt.callHook('devtools:customTabs:refresh') }, 100) diff --git a/src/nuxt-vitest/utils.ts b/src/nuxt-vitest/utils.ts index 09245f80e..893cd4318 100644 --- a/src/nuxt-vitest/utils.ts +++ b/src/nuxt-vitest/utils.ts @@ -1 +1 @@ -export * from 'vitest-environment-nuxt/utils' +export * from '../vitest-environment-nuxt/utils' diff --git a/src/vitest-environment-nuxt/index.ts b/src/vitest-environment-nuxt/index.ts index 8aca9cf75..6c05b4a6c 100644 --- a/src/vitest-environment-nuxt/index.ts +++ b/src/vitest-environment-nuxt/index.ts @@ -149,7 +149,6 @@ export default { registry.add(`${manifestOutputPath}/meta/test.json`) registry.add(`${manifestOutputPath}/meta/dev.json`) - // @ts-expect-error TODO: ensure alias is known await import('#app/entry').then(r => r.default()) return { diff --git a/src/vitest-environment-nuxt/module.ts b/src/vitest-environment-nuxt/module.ts deleted file mode 100644 index 5c5692d44..000000000 --- a/src/vitest-environment-nuxt/module.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { defineNuxtModule, installModule } from '@nuxt/kit' -import mockTransform from './modules/mock' - -export default defineNuxtModule({ - meta: { - name: 'vitest-env', - }, - async setup() { - await installModule(mockTransform) - }, -}) diff --git a/src/vitest-environment-nuxt/modules/mock.ts b/src/vitest-environment-nuxt/modules/mock.ts deleted file mode 100644 index 372384982..000000000 --- a/src/vitest-environment-nuxt/modules/mock.ts +++ /dev/null @@ -1,328 +0,0 @@ -import type { Import, Unimport } from 'unimport' -import { addVitePlugin, defineNuxtModule } from '@nuxt/kit' -import { walk } from 'estree-walker' -import type { CallExpression } from 'estree' -import type { AcornNode } from 'rollup' -import MagicString from 'magic-string' -import type { Component } from '@nuxt/schema' -import type { Plugin } from 'vite' -import { normalize, resolve } from 'node:path' - -const PLUGIN_NAME = 'nuxt:vitest:mock-transform' - -const HELPER_MOCK_IMPORT = 'mockNuxtImport' -const HELPER_MOCK_COMPONENT = 'mockComponent' -const HELPER_MOCK_HOIST = '__NUXT_VITEST_MOCKS' - -const HELPERS_NAME = [HELPER_MOCK_IMPORT, HELPER_MOCK_COMPONENT] - -export interface MockImportInfo { - name: string - import: Import - factory: string -} - -export interface MockComponentInfo { - path: string - factory: string -} - -/** - * This module is a macro that transforms `mockNuxtImport()` to `vi.mock()`, - * which make it possible to mock Nuxt imports. - */ -export default defineNuxtModule({ - meta: { - name: PLUGIN_NAME, - }, - setup(_, nuxt) { - let importsCtx: Unimport - let imports: Import[] = [] - let components: Component[] = [] - - nuxt.hook('imports:context', async ctx => { - importsCtx = ctx - }) - nuxt.hook('components:extend', _ => { - components = _ - }) - nuxt.hook('ready', async () => { - imports = await importsCtx.getImports() - }) - - // Polyfill Array.prototype.findLastIndex for legacy Node.js - function findLastIndex(arr: T[], predicate: (item: T) => boolean) { - for (let i = arr.length - 1; i >= 0; i--) { - if (predicate(arr[i])) return i - } - return -1 - } - - // path of the first vitest setup file to be ran - let resolvedFirstSetupFile: null | string = null - addVitePlugin({ - name: PLUGIN_NAME, - enforce: 'post', - // Place Vitest's mock plugin after all Nuxt plugins - configResolved(config) { - const firstSetupFile = Array.isArray(config.test?.setupFiles) - ? config.test!.setupFiles[0] - : config.test?.setupFiles - - if (firstSetupFile) { - resolvedFirstSetupFile = normalize(resolve(firstSetupFile)) - } - - const plugins = (config.plugins || []) as Plugin[] - // `vite:mocks` was a typo in Vitest before v0.34.0 - const mockPluginIndex = plugins.findIndex( - i => i.name === 'vite:mocks' || i.name === 'vitest:mocks' - ) - const lastNuxt = findLastIndex( - plugins, - i => i.name?.startsWith('nuxt:') - ) - if (mockPluginIndex !== -1 && lastNuxt !== -1) { - if (mockPluginIndex < lastNuxt) { - const [mockPlugin] = plugins.splice(mockPluginIndex, 1) - plugins.splice(lastNuxt, 0, mockPlugin) - } - } - }, - transform: { - handler(code, id) { - const isFirstSetupFile = normalize(id) === resolvedFirstSetupFile - const shouldPrependMockHoist = resolvedFirstSetupFile - ? isFirstSetupFile - : true - - if (!HELPERS_NAME.some(n => code.includes(n))) return - if (id.includes('/node_modules/')) return - - let ast: AcornNode - try { - ast = this.parse(code, { - sourceType: 'module', - ecmaVersion: 'latest', - ranges: true, - }) - } catch (e) { - return - } - - let insertionPoint = 0 - let hasViImport = false - - const s = new MagicString(code) - const mocksImport: MockImportInfo[] = [] - const mocksComponent: MockComponentInfo[] = [] - const importPathsList: Set = new Set() - - walk(ast as any, { - enter: (node, parent) => { - // find existing vi import - if (node.type === 'ImportDeclaration') { - if (node.source.value === 'vitest' && !hasViImport) { - if ( - node.specifiers.find( - i => - i.type === 'ImportSpecifier' && i.imported.name === 'vi' - ) - ) { - insertionPoint = node.range![1] - hasViImport = true - } - return - } - } - - if (node.type !== 'CallExpression') return - const call = node as CallExpression - // mockNuxtImport - if ( - call.callee.type === 'Identifier' && - call.callee.name === HELPER_MOCK_IMPORT - ) { - if (call.arguments.length !== 2) { - return this.error( - new Error( - `${HELPER_MOCK_IMPORT}() should have exactly 2 arguments` - ), - call.range![0] - ) - } - if (call.arguments[0].type !== 'Literal') { - return this.error( - new Error( - `The first argument of ${HELPER_MOCK_IMPORT}() must be a string literal` - ), - call.arguments[0].range![0] - ) - } - const name = call.arguments[0].value as string - const importItem = imports.find(_ => name === (_.as || _.name)) - if (!importItem) { - console.log({ imports }) - return this.error(`Cannot find import "${name}" to mock`) - } - - s.overwrite( - parent?.type === 'ExpressionStatement' - ? parent.range![0] - : call.arguments[0].range![0], - parent?.type === 'ExpressionStatement' - ? parent.range![1] - : call.arguments[1].range![1], - '' - ) - mocksImport.push({ - name, - import: importItem, - factory: code.slice( - call.arguments[1].range![0], - call.arguments[1].range![1] - ), - }) - } - // mockComponent - if ( - call.callee.type === 'Identifier' && - call.callee.name === HELPER_MOCK_COMPONENT - ) { - if (call.arguments.length !== 2) { - return this.error( - new Error( - `${HELPER_MOCK_COMPONENT}() should have exactly 2 arguments` - ), - call.range![0] - ) - } - if (call.arguments[0].type !== 'Literal') { - return this.error( - new Error( - `The first argument of ${HELPER_MOCK_COMPONENT}() must be a string literal` - ), - call.arguments[0].range![0] - ) - } - const pathOrName = call.arguments[0].value as string - const component = components.find( - _ => _.pascalName === pathOrName || _.kebabName === pathOrName - ) - const path = component?.filePath || pathOrName - - s.overwrite( - parent?.type === 'ExpressionStatement' - ? parent.range![0] - : call.arguments[1].range![0], - parent?.type === 'ExpressionStatement' - ? parent.range![1] - : call.arguments[1].range![1], - '' - ) - mocksComponent.push({ - path: path, - factory: code.slice( - call.arguments[1].range![0], - call.arguments[1].range![1] - ), - }) - } - }, - }) - - if (mocksImport.length === 0 && mocksComponent.length === 0) return - - const mockLines = [] - - if (mocksImport.length) { - const mockImportMap = new Map() - for (const mock of mocksImport) { - if (!mockImportMap.has(mock.import.from)) { - mockImportMap.set(mock.import.from, []) - } - mockImportMap.get(mock.import.from)!.push(mock) - } - mockLines.push( - ...Array.from(mockImportMap.entries()).flatMap( - ([from, mocks]) => { - importPathsList.add(from) - const lines = [ - `vi.mock(${JSON.stringify( - from - )}, async (importOriginal) => {`, - ` const mocks = global.${HELPER_MOCK_HOIST}`, - ` if (!mocks[${JSON.stringify( - from - )}]) { mocks[${JSON.stringify( - from - )}] = { ...await importOriginal(${JSON.stringify( - from - )}) } }`, - ] - for (const mock of mocks) { - if (mock.import.name === 'default') { - lines.push( - ` mocks[${JSON.stringify(from)}]["default"] = await (${ - mock.factory - })()` - ) - } else { - lines.push( - ` mocks[${JSON.stringify(from)}][${JSON.stringify( - mock.name - )}] = await (${mock.factory})()` - ) - } - } - lines.push(` return mocks[${JSON.stringify(from)}] `) - lines.push(`})`) - return lines - } - ) - ) - } - - if (mocksComponent.length) { - mockLines.push( - ...mocksComponent.flatMap(mock => { - return [ - `vi.mock(${JSON.stringify(mock.path)}, async () => {`, - ` const factory = (${mock.factory});`, - ` const result = typeof factory === 'function' ? await factory() : await factory`, - ` return 'default' in result ? result : { default: result }`, - '})', - ] - }) - ) - } - - if (!mockLines.length) return - - s.prepend(`vi.hoisted(() => { - if(!global.${HELPER_MOCK_HOIST}){ - vi.stubGlobal(${JSON.stringify(HELPER_MOCK_HOIST)}, {}) - } - });\n`) - - if (!hasViImport) s.prepend(`import {vi} from "vitest";\n`) - - s.appendLeft(insertionPoint, mockLines.join('\n') + '\n') - - // do an import to trick vite to keep it - // if not, the module won't be mocked - if (shouldPrependMockHoist) { - importPathsList.forEach(p => { - s.append(`\n import ${JSON.stringify(p)};`) - }) - } - - return { - code: s.toString(), - map: s.generateMap(), - } - }, - }, - }) - }, -}) diff --git a/stubs/vitest-environment-nuxt/index.mjs b/stubs/vitest-environment-nuxt/index.mjs new file mode 100644 index 000000000..fad3212a8 --- /dev/null +++ b/stubs/vitest-environment-nuxt/index.mjs @@ -0,0 +1 @@ +export { default } from '@nuxt/test-utils/vitest-environment' diff --git a/stubs/vitest-environment-nuxt/package.json b/stubs/vitest-environment-nuxt/package.json new file mode 100644 index 000000000..658b8f7d9 --- /dev/null +++ b/stubs/vitest-environment-nuxt/package.json @@ -0,0 +1,8 @@ +{ + "type": "module", + "name": "vitest-environment-nuxt", + "version": "0.0.0", + "exports": { + ".": "./index.mjs" + } +} diff --git a/test/fixtures/nuxt-vitest/nuxt.config.ts b/test/fixtures/nuxt-vitest/nuxt.config.ts index 58a309580..219ebea51 100644 --- a/test/fixtures/nuxt-vitest/nuxt.config.ts +++ b/test/fixtures/nuxt-vitest/nuxt.config.ts @@ -15,6 +15,16 @@ export default defineNuxtConfig({ }, }, }, + // vite: { + // // TODO: fix bug with stubbing root package + // resolve: { + // alias: { + // '@nuxt/test-utils/config': '../../../src/config', + // '@nuxt/test-utils/module': '../../../src/module', + // '@nuxt/test-utils/runtime-utils': '../../../src/runtime-utils', + // }, + // }, + // }, imports: { injectAtEnd: true, }, diff --git a/test/fixtures/nuxt-vitest/.gitignore b/test/fixtures/runtime/.gitignore similarity index 100% rename from test/fixtures/nuxt-vitest/.gitignore rename to test/fixtures/runtime/.gitignore diff --git a/test/fixtures/nuxt-vitest/app.config.ts b/test/fixtures/runtime/app.config.ts similarity index 100% rename from test/fixtures/nuxt-vitest/app.config.ts rename to test/fixtures/runtime/app.config.ts diff --git a/test/fixtures/nuxt-vitest/app.vue b/test/fixtures/runtime/app.vue similarity index 100% rename from test/fixtures/nuxt-vitest/app.vue rename to test/fixtures/runtime/app.vue diff --git a/test/fixtures/nuxt-vitest/components/ExportDefaultComponent.vue b/test/fixtures/runtime/components/ExportDefaultComponent.vue similarity index 100% rename from test/fixtures/nuxt-vitest/components/ExportDefaultComponent.vue rename to test/fixtures/runtime/components/ExportDefaultComponent.vue diff --git a/test/fixtures/nuxt-vitest/components/ExportDefaultReturnsRenderComponent.vue b/test/fixtures/runtime/components/ExportDefaultReturnsRenderComponent.vue similarity index 100% rename from test/fixtures/nuxt-vitest/components/ExportDefaultReturnsRenderComponent.vue rename to test/fixtures/runtime/components/ExportDefaultReturnsRenderComponent.vue diff --git a/test/fixtures/nuxt-vitest/components/ExportDefaultWithRenderComponent.vue b/test/fixtures/runtime/components/ExportDefaultWithRenderComponent.vue similarity index 100% rename from test/fixtures/nuxt-vitest/components/ExportDefaultWithRenderComponent.vue rename to test/fixtures/runtime/components/ExportDefaultWithRenderComponent.vue diff --git a/test/fixtures/nuxt-vitest/components/ExportDefineComponent.vue b/test/fixtures/runtime/components/ExportDefineComponent.vue similarity index 100% rename from test/fixtures/nuxt-vitest/components/ExportDefineComponent.vue rename to test/fixtures/runtime/components/ExportDefineComponent.vue diff --git a/test/fixtures/nuxt-vitest/components/FetchComponent.vue b/test/fixtures/runtime/components/FetchComponent.vue similarity index 100% rename from test/fixtures/nuxt-vitest/components/FetchComponent.vue rename to test/fixtures/runtime/components/FetchComponent.vue diff --git a/test/fixtures/nuxt-vitest/components/GlobalComponent.global.vue b/test/fixtures/runtime/components/GlobalComponent.global.vue similarity index 100% rename from test/fixtures/nuxt-vitest/components/GlobalComponent.global.vue rename to test/fixtures/runtime/components/GlobalComponent.global.vue diff --git a/test/fixtures/nuxt-vitest/components/IndexedDbComponent.vue b/test/fixtures/runtime/components/IndexedDbComponent.vue similarity index 100% rename from test/fixtures/nuxt-vitest/components/IndexedDbComponent.vue rename to test/fixtures/runtime/components/IndexedDbComponent.vue diff --git a/test/fixtures/nuxt-vitest/components/OptionsComponent.vue b/test/fixtures/runtime/components/OptionsComponent.vue similarity index 100% rename from test/fixtures/nuxt-vitest/components/OptionsComponent.vue rename to test/fixtures/runtime/components/OptionsComponent.vue diff --git a/test/fixtures/nuxt-vitest/components/SomeComponent.vue b/test/fixtures/runtime/components/SomeComponent.vue similarity index 100% rename from test/fixtures/nuxt-vitest/components/SomeComponent.vue rename to test/fixtures/runtime/components/SomeComponent.vue diff --git a/test/fixtures/nuxt-vitest/components/WrapperTests.vue b/test/fixtures/runtime/components/WrapperTests.vue similarity index 100% rename from test/fixtures/nuxt-vitest/components/WrapperTests.vue rename to test/fixtures/runtime/components/WrapperTests.vue diff --git a/test/fixtures/nuxt-vitest/composables/auto-import-mock.ts b/test/fixtures/runtime/composables/auto-import-mock.ts similarity index 100% rename from test/fixtures/nuxt-vitest/composables/auto-import-mock.ts rename to test/fixtures/runtime/composables/auto-import-mock.ts diff --git a/test/fixtures/nuxt-vitest/composables/use-default-export.ts b/test/fixtures/runtime/composables/use-default-export.ts similarity index 100% rename from test/fixtures/nuxt-vitest/composables/use-default-export.ts rename to test/fixtures/runtime/composables/use-default-export.ts diff --git a/test/fixtures/nuxt-vitest/composables/use-single-state.ts b/test/fixtures/runtime/composables/use-single-state.ts similarity index 100% rename from test/fixtures/nuxt-vitest/composables/use-single-state.ts rename to test/fixtures/runtime/composables/use-single-state.ts diff --git a/test/fixtures/nuxt-vitest/modules/custom.ts b/test/fixtures/runtime/modules/custom.ts similarity index 100% rename from test/fixtures/nuxt-vitest/modules/custom.ts rename to test/fixtures/runtime/modules/custom.ts diff --git a/test/fixtures/nuxt-vitest/modules/runtime/composables/auto-import-mock.ts b/test/fixtures/runtime/modules/runtime/composables/auto-import-mock.ts similarity index 100% rename from test/fixtures/nuxt-vitest/modules/runtime/composables/auto-import-mock.ts rename to test/fixtures/runtime/modules/runtime/composables/auto-import-mock.ts diff --git a/test/fixtures/runtime/nuxt.config.ts b/test/fixtures/runtime/nuxt.config.ts new file mode 100644 index 000000000..1f9b9617e --- /dev/null +++ b/test/fixtures/runtime/nuxt.config.ts @@ -0,0 +1,36 @@ +// https://v3.nuxtjs.org/api/configuration/nuxt.config +export default defineNuxtConfig({ + modules: ['@nuxt/test-utils/module', '@nuxt/devtools', '~/modules/custom'], + vitest: { + startOnBoot: true, + logToConsole: true, + vitestConfig: { + setupFiles: ['./tests/setup/mocks'], + environmentOptions: { + nuxt: { + mock: { + indexedDb: true, + }, + }, + }, + }, + }, + vite: { + // TODO: fix bug with stubbing root package + resolve: { + alias: { + '@nuxt/test-utils/config': '../../../src/config', + '@nuxt/test-utils/module': '../../../src/module', + '@nuxt/test-utils/runtime-utils': '../../../src/utils', + }, + }, + }, + imports: { + injectAtEnd: true, + }, + runtimeConfig: { + public: { + hello: 'world', + }, + }, +}) diff --git a/test/fixtures/nuxt-vitest/package.json b/test/fixtures/runtime/package.json similarity index 92% rename from test/fixtures/nuxt-vitest/package.json rename to test/fixtures/runtime/package.json index 38510f4fc..726a7fba0 100644 --- a/test/fixtures/nuxt-vitest/package.json +++ b/test/fixtures/runtime/package.json @@ -4,6 +4,7 @@ "scripts": { "build": "nuxt build", "dev": "nuxt dev", + "dev:prepare": "nuxt prepare", "generate": "nuxt generate", "preview": "nuxt preview", "test:dev": "NUXT_VITEST_DEV_TEST=true nuxt dev --no-fork", @@ -22,6 +23,7 @@ "nuxt": "3.8.2", "typescript": "5.2.2", "vitest": "0.33.0", + "vitest-environment-nuxt": "0.0.0", "vue-tsc": "1.8.19" }, "version": "0.10.2", diff --git a/test/fixtures/nuxt-vitest/pages/[...slug].vue b/test/fixtures/runtime/pages/[...slug].vue similarity index 100% rename from test/fixtures/nuxt-vitest/pages/[...slug].vue rename to test/fixtures/runtime/pages/[...slug].vue diff --git a/test/fixtures/nuxt-vitest/pages/index.vue b/test/fixtures/runtime/pages/index.vue similarity index 100% rename from test/fixtures/nuxt-vitest/pages/index.vue rename to test/fixtures/runtime/pages/index.vue diff --git a/test/fixtures/nuxt-vitest/plugins/async.ts b/test/fixtures/runtime/plugins/async.ts similarity index 100% rename from test/fixtures/nuxt-vitest/plugins/async.ts rename to test/fixtures/runtime/plugins/async.ts diff --git a/test/fixtures/nuxt-vitest/plugins/auth.ts b/test/fixtures/runtime/plugins/auth.ts similarity index 100% rename from test/fixtures/nuxt-vitest/plugins/auth.ts rename to test/fixtures/runtime/plugins/auth.ts diff --git a/test/fixtures/nuxt-vitest/plugins/indexeddb.ts b/test/fixtures/runtime/plugins/indexeddb.ts similarity index 100% rename from test/fixtures/nuxt-vitest/plugins/indexeddb.ts rename to test/fixtures/runtime/plugins/indexeddb.ts diff --git a/test/fixtures/nuxt-vitest/tests/nuxt/auto-import-mock.spec.ts b/test/fixtures/runtime/tests/nuxt/auto-import-mock.spec.ts similarity index 94% rename from test/fixtures/nuxt-vitest/tests/nuxt/auto-import-mock.spec.ts rename to test/fixtures/runtime/tests/nuxt/auto-import-mock.spec.ts index 2b75a97b3..2125dd905 100644 --- a/test/fixtures/nuxt-vitest/tests/nuxt/auto-import-mock.spec.ts +++ b/test/fixtures/runtime/tests/nuxt/auto-import-mock.spec.ts @@ -1,5 +1,5 @@ import { expect, it, vi } from 'vitest' -import { mockNuxtImport } from 'vitest-environment-nuxt/utils' +import { mockNuxtImport } from '@nuxt/test-utils/runtime-utils' mockNuxtImport('useAutoImportedTarget', () => { return () => 'mocked!' diff --git a/test/fixtures/nuxt-vitest/tests/nuxt/auto-import.spec.ts b/test/fixtures/runtime/tests/nuxt/auto-import.spec.ts similarity index 100% rename from test/fixtures/nuxt-vitest/tests/nuxt/auto-import.spec.ts rename to test/fixtures/runtime/tests/nuxt/auto-import.spec.ts diff --git a/test/fixtures/nuxt-vitest/tests/nuxt/config.spec.ts b/test/fixtures/runtime/tests/nuxt/config.spec.ts similarity index 100% rename from test/fixtures/nuxt-vitest/tests/nuxt/config.spec.ts rename to test/fixtures/runtime/tests/nuxt/config.spec.ts diff --git a/test/fixtures/nuxt-vitest/tests/nuxt/export-define-component.spec.ts b/test/fixtures/runtime/tests/nuxt/export-define-component.spec.ts similarity index 96% rename from test/fixtures/nuxt-vitest/tests/nuxt/export-define-component.spec.ts rename to test/fixtures/runtime/tests/nuxt/export-define-component.spec.ts index 75d17bc69..fd9825df1 100644 --- a/test/fixtures/nuxt-vitest/tests/nuxt/export-define-component.spec.ts +++ b/test/fixtures/runtime/tests/nuxt/export-define-component.spec.ts @@ -1,5 +1,5 @@ import { expect, it } from 'vitest' -import { mountSuspended } from 'vitest-environment-nuxt/utils' +import { mountSuspended } from '@nuxt/test-utils/runtime-utils' import ExportDefaultComponent from '~/components/ExportDefaultComponent.vue' import ExportDefineComponent from '~/components/ExportDefineComponent.vue' import ExportDefaultWithRenderComponent from '~/components/ExportDefaultWithRenderComponent.vue' diff --git a/test/fixtures/nuxt-vitest/tests/nuxt/index.spec.ts b/test/fixtures/runtime/tests/nuxt/index.spec.ts similarity index 98% rename from test/fixtures/nuxt-vitest/tests/nuxt/index.spec.ts rename to test/fixtures/runtime/tests/nuxt/index.spec.ts index 7c40e101c..0ae1b6918 100644 --- a/test/fixtures/nuxt-vitest/tests/nuxt/index.spec.ts +++ b/test/fixtures/runtime/tests/nuxt/index.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' -import { mountSuspended, registerEndpoint } from 'vitest-environment-nuxt/utils' +import { mountSuspended, registerEndpoint } from '@nuxt/test-utils/runtime-utils' import { listen } from 'listhen' import { createApp, eventHandler, toNodeListener } from 'h3' diff --git a/test/fixtures/nuxt-vitest/tests/nuxt/mock-component-1.spec.ts b/test/fixtures/runtime/tests/nuxt/mock-component-1.spec.ts similarity index 86% rename from test/fixtures/nuxt-vitest/tests/nuxt/mock-component-1.spec.ts rename to test/fixtures/runtime/tests/nuxt/mock-component-1.spec.ts index 640e75a90..99e31fd19 100644 --- a/test/fixtures/nuxt-vitest/tests/nuxt/mock-component-1.spec.ts +++ b/test/fixtures/runtime/tests/nuxt/mock-component-1.spec.ts @@ -1,5 +1,5 @@ import { expect, it } from 'vitest' -import { mockComponent, mountSuspended } from 'vitest-environment-nuxt/utils' +import { mockComponent, mountSuspended } from '@nuxt/test-utils/runtime-utils' import App from '~/app.vue' mockComponent('SomeComponent', async () => { diff --git a/test/fixtures/nuxt-vitest/tests/nuxt/mock-component-2.spec.ts b/test/fixtures/runtime/tests/nuxt/mock-component-2.spec.ts similarity index 84% rename from test/fixtures/nuxt-vitest/tests/nuxt/mock-component-2.spec.ts rename to test/fixtures/runtime/tests/nuxt/mock-component-2.spec.ts index 8d086baa1..85b187a11 100644 --- a/test/fixtures/nuxt-vitest/tests/nuxt/mock-component-2.spec.ts +++ b/test/fixtures/runtime/tests/nuxt/mock-component-2.spec.ts @@ -1,5 +1,5 @@ import { expect, it } from 'vitest' -import { mockComponent, mountSuspended } from 'vitest-environment-nuxt/utils' +import { mockComponent, mountSuspended } from '@nuxt/test-utils/runtime-utils' import App from '~/app.vue' mockComponent('SomeComponent', () => import('./mocks/MockComponent.vue')) diff --git a/test/fixtures/nuxt-vitest/tests/nuxt/mock-component-expose-setup-state.spec.ts b/test/fixtures/runtime/tests/nuxt/mock-component-expose-setup-state.spec.ts similarity index 82% rename from test/fixtures/nuxt-vitest/tests/nuxt/mock-component-expose-setup-state.spec.ts rename to test/fixtures/runtime/tests/nuxt/mock-component-expose-setup-state.spec.ts index 8359e703e..68077ff58 100644 --- a/test/fixtures/nuxt-vitest/tests/nuxt/mock-component-expose-setup-state.spec.ts +++ b/test/fixtures/runtime/tests/nuxt/mock-component-expose-setup-state.spec.ts @@ -1,5 +1,5 @@ import { expect, it } from 'vitest' -import { mountSuspended } from 'vitest-environment-nuxt/utils' +import { mountSuspended } from '@nuxt/test-utils/runtime-utils' import MockComponent from './mocks/MockComponent.vue' it('should expose setup state', async () => { diff --git a/test/fixtures/nuxt-vitest/tests/nuxt/mock-indexeddb.spec.ts b/test/fixtures/runtime/tests/nuxt/mock-indexeddb.spec.ts similarity index 87% rename from test/fixtures/nuxt-vitest/tests/nuxt/mock-indexeddb.spec.ts rename to test/fixtures/runtime/tests/nuxt/mock-indexeddb.spec.ts index bccd90d80..8a0c46cad 100644 --- a/test/fixtures/nuxt-vitest/tests/nuxt/mock-indexeddb.spec.ts +++ b/test/fixtures/runtime/tests/nuxt/mock-indexeddb.spec.ts @@ -1,5 +1,5 @@ import { expect, it } from 'vitest' -import { mountSuspended } from 'vitest-environment-nuxt/utils' +import { mountSuspended } from '@nuxt/test-utils/runtime-utils' import IndexedDbComponent from '~/components/IndexedDbComponent.vue' // Mocking of indexedDB can be enabled in vite.config.ts diff --git a/test/fixtures/nuxt-vitest/tests/nuxt/mock-nuxt-composable-1.spec.ts b/test/fixtures/runtime/tests/nuxt/mock-nuxt-composable-1.spec.ts similarity index 84% rename from test/fixtures/nuxt-vitest/tests/nuxt/mock-nuxt-composable-1.spec.ts rename to test/fixtures/runtime/tests/nuxt/mock-nuxt-composable-1.spec.ts index 6d0352fa8..58f7f362c 100644 --- a/test/fixtures/nuxt-vitest/tests/nuxt/mock-nuxt-composable-1.spec.ts +++ b/test/fixtures/runtime/tests/nuxt/mock-nuxt-composable-1.spec.ts @@ -1,5 +1,5 @@ import { expect, it } from 'vitest' -import { mockNuxtImport } from 'vitest-environment-nuxt/utils' +import { mockNuxtImport } from '@nuxt/test-utils/runtime-utils' mockNuxtImport('useRuntimeConfig', () => { return () => { diff --git a/test/fixtures/nuxt-vitest/tests/nuxt/mock-nuxt-composable-2.spec.ts b/test/fixtures/runtime/tests/nuxt/mock-nuxt-composable-2.spec.ts similarity index 75% rename from test/fixtures/nuxt-vitest/tests/nuxt/mock-nuxt-composable-2.spec.ts rename to test/fixtures/runtime/tests/nuxt/mock-nuxt-composable-2.spec.ts index c73bfadd1..daa1435ba 100644 --- a/test/fixtures/nuxt-vitest/tests/nuxt/mock-nuxt-composable-2.spec.ts +++ b/test/fixtures/runtime/tests/nuxt/mock-nuxt-composable-2.spec.ts @@ -1,5 +1,5 @@ import { expect, it } from 'vitest' -import { mockNuxtImport } from 'vitest-environment-nuxt/utils' +import { mockNuxtImport } from '@nuxt/test-utils/runtime-utils' mockNuxtImport('useHead', () => { return () => true diff --git a/test/fixtures/nuxt-vitest/tests/nuxt/mock-nuxt-composable-3.spec.ts b/test/fixtures/runtime/tests/nuxt/mock-nuxt-composable-3.spec.ts similarity index 87% rename from test/fixtures/nuxt-vitest/tests/nuxt/mock-nuxt-composable-3.spec.ts rename to test/fixtures/runtime/tests/nuxt/mock-nuxt-composable-3.spec.ts index 87cb22633..28fec9ee4 100644 --- a/test/fixtures/nuxt-vitest/tests/nuxt/mock-nuxt-composable-3.spec.ts +++ b/test/fixtures/runtime/tests/nuxt/mock-nuxt-composable-3.spec.ts @@ -1,5 +1,5 @@ import { expect, it } from 'vitest' -import { mockNuxtImport } from 'vitest-environment-nuxt/utils' +import { mockNuxtImport } from '@nuxt/test-utils/runtime-utils' mockNuxtImport('useAutoImportedTarget', () => { return () => 'mocked' diff --git a/test/fixtures/nuxt-vitest/tests/nuxt/mocks/MockComponent.vue b/test/fixtures/runtime/tests/nuxt/mocks/MockComponent.vue similarity index 100% rename from test/fixtures/nuxt-vitest/tests/nuxt/mocks/MockComponent.vue rename to test/fixtures/runtime/tests/nuxt/mocks/MockComponent.vue diff --git a/test/fixtures/nuxt-vitest/tests/nuxt/utils-render.spec.ts b/test/fixtures/runtime/tests/nuxt/utils-render.spec.ts similarity index 97% rename from test/fixtures/nuxt-vitest/tests/nuxt/utils-render.spec.ts rename to test/fixtures/runtime/tests/nuxt/utils-render.spec.ts index b6d2d58c8..4141f1ddc 100644 --- a/test/fixtures/nuxt-vitest/tests/nuxt/utils-render.spec.ts +++ b/test/fixtures/runtime/tests/nuxt/utils-render.spec.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it } from 'vitest' -import { renderSuspended } from 'vitest-environment-nuxt/utils' +import { renderSuspended } from '@nuxt/test-utils/runtime-utils' import { cleanup, fireEvent, screen } from '@testing-library/vue' import App from '~/app.vue' diff --git a/test/fixtures/nuxt-vitest/tests/setup/mocks.ts b/test/fixtures/runtime/tests/setup/mocks.ts similarity index 84% rename from test/fixtures/nuxt-vitest/tests/setup/mocks.ts rename to test/fixtures/runtime/tests/setup/mocks.ts index abcecfff0..65c296da1 100644 --- a/test/fixtures/nuxt-vitest/tests/setup/mocks.ts +++ b/test/fixtures/runtime/tests/setup/mocks.ts @@ -1,5 +1,5 @@ import { vi } from 'vitest' -import { mockNuxtImport } from 'vitest-environment-nuxt/utils' +import { mockNuxtImport } from '@nuxt/test-utils/runtime-utils' mockNuxtImport( 'useAutoImportSetupMocked', diff --git a/test/fixtures/nuxt-vitest/tests/unit/index.spec.ts b/test/fixtures/runtime/tests/unit/index.spec.ts similarity index 100% rename from test/fixtures/nuxt-vitest/tests/unit/index.spec.ts rename to test/fixtures/runtime/tests/unit/index.spec.ts diff --git a/test/fixtures/nuxt-vitest/tsconfig.json b/test/fixtures/runtime/tsconfig.json similarity index 100% rename from test/fixtures/nuxt-vitest/tsconfig.json rename to test/fixtures/runtime/tsconfig.json diff --git a/test/fixtures/nuxt-vitest/vitest.config.ts b/test/fixtures/runtime/vitest.config.ts similarity index 89% rename from test/fixtures/nuxt-vitest/vitest.config.ts rename to test/fixtures/runtime/vitest.config.ts index dcbd3fc3f..b18e2263d 100644 --- a/test/fixtures/nuxt-vitest/vitest.config.ts +++ b/test/fixtures/runtime/vitest.config.ts @@ -1,5 +1,5 @@ import { fileURLToPath } from 'node:url' -import { defineVitestConfig } from '@nuxt/test-utils/config' +import { defineVitestConfig } from '../../../src/config' export default defineVitestConfig({ test: { diff --git a/tsconfig.json b/tsconfig.json index b9b8e1a93..365a84c72 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,18 +1,7 @@ { + "extends": "./.nuxt/tsconfig.json", "compilerOptions": { - "forceConsistentCasingInFileNames": true, - "esModuleInterop": false, - "allowSyntheticDefaultImports": true, - "skipLibCheck": true, - "target": "ESNext", - "module": "ESNext", "moduleResolution": "Bundler", - "strict": true, - "noImplicitAny": true, - "allowJs": true, - "noEmit": true, - "noUnusedLocals": true, - "resolveJsonModule": true }, "exclude": [ "**/dist/**" From 1be8f9dfa99e145ead26614e1f981d0c002c3d44 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 21 Nov 2023 10:59:00 +0000 Subject: [PATCH 03/15] chore: use link --- package.json | 2 +- pnpm-lock.yaml | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 4aef93870..8a7b835c5 100644 --- a/package.json +++ b/package.json @@ -118,7 +118,7 @@ }, "resolutions": { "@nuxt/test-utils": "workspace:*", - "vitest-environment-nuxt": "file:./stubs/vitest-environment-nuxt" + "vitest-environment-nuxt": "link:./stubs/vitest-environment-nuxt" }, "engines": { "node": "^14.18.0 || >=16.10.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 91cdec878..4d927198c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,7 +6,7 @@ settings: overrides: '@nuxt/test-utils': workspace:* - vitest-environment-nuxt: file:./stubs/vitest-environment-nuxt + vitest-environment-nuxt: link:./stubs/vitest-environment-nuxt importers: @@ -165,8 +165,8 @@ importers: specifier: ^12.10.3 version: 12.10.3 vitest-environment-nuxt: - specifier: file:/Users/daniel/code/nuxt/test-utils/stubs/vitest-environment-nuxt - version: file:stubs/vitest-environment-nuxt + specifier: link:../../stubs/vitest-environment-nuxt + version: link:../../stubs/vitest-environment-nuxt examples/app-jest: dependencies: @@ -233,8 +233,8 @@ importers: specifier: 0.33.0 version: 0.33.0(happy-dom@12.10.3)(jsdom@22.1.0) vitest-environment-nuxt: - specifier: file:/Users/daniel/code/nuxt/test-utils/stubs/vitest-environment-nuxt - version: file:stubs/vitest-environment-nuxt + specifier: link:../../stubs/vitest-environment-nuxt + version: link:../../stubs/vitest-environment-nuxt examples/module/playground: dependencies: @@ -9372,8 +9372,3 @@ packages: archiver-utils: 4.0.1 compress-commons: 5.0.1 readable-stream: 3.6.2 - - file:stubs/vitest-environment-nuxt: - resolution: {directory: stubs/vitest-environment-nuxt, type: directory} - name: vitest-environment-nuxt - dev: true From 8ddb99f6849b2ae1e00318f64007498273d3d177 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 21 Nov 2023 11:00:57 +0000 Subject: [PATCH 04/15] chore: fix import path --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 22911f309..f8604f58d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,6 +3,6 @@ export * from './core/context' export * from './core/mock' export * from './core/nuxt' export * from './core/server' -export * from './core/setup' +export * from './core/setup/index' export * from './core/run' export * from './core/types' From 9b350e96571063847e4b47fdbeb76435e77e569e Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 21 Nov 2023 11:01:43 +0000 Subject: [PATCH 05/15] chore: lockfile --- pnpm-lock.yaml | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4d927198c..ace6cdd2d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -141,7 +141,7 @@ importers: version: 4.5.0(@types/node@20.8.10) vitest: specifier: 0.33.0 - version: 0.33.0(happy-dom@12.10.3)(jsdom@22.1.0) + version: 0.33.0 vue-router: specifier: ^4.2.5 version: 4.2.5(vue@3.3.8) @@ -231,7 +231,7 @@ importers: version: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0) vitest: specifier: 0.33.0 - version: 0.33.0(happy-dom@12.10.3)(jsdom@22.1.0) + version: 0.33.0 vitest-environment-nuxt: specifier: link:../../stubs/vitest-environment-nuxt version: link:../../stubs/vitest-environment-nuxt @@ -2309,6 +2309,7 @@ packages: /@tootallnate/once@2.0.0: resolution: {integrity: sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==} engines: {node: '>= 10'} + dev: false /@trysound/sax@0.2.0: resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==} @@ -2842,6 +2843,7 @@ packages: /abab@2.0.6: resolution: {integrity: sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==} + dev: false /abbrev@1.1.1: resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} @@ -3112,6 +3114,7 @@ packages: /asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + dev: false /autoprefixer@10.4.16(postcss@8.4.31): resolution: {integrity: sha512-7vd3UC6xKp0HLfua5IjZlcXvGAGy7cBAXTg2lyQ/8WpNhd6SiZ8Be+xm3FyBSYJx5GKcpRCzBh7RH4/0dnY+uQ==} @@ -3541,6 +3544,7 @@ packages: engines: {node: '>= 0.8'} dependencies: delayed-stream: 1.0.0 + dev: false /commander@10.0.1: resolution: {integrity: sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==} @@ -3756,6 +3760,7 @@ packages: engines: {node: '>=14'} dependencies: rrweb-cssom: 0.6.0 + dev: false /csstype@3.1.2: resolution: {integrity: sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==} @@ -3767,6 +3772,7 @@ packages: abab: 2.0.6 whatwg-mimetype: 3.0.0 whatwg-url: 12.0.1 + dev: false /debug@2.6.9: resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} @@ -3802,6 +3808,7 @@ packages: /decimal.js@10.4.3: resolution: {integrity: sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==} + dev: false /dedent@1.5.1: resolution: {integrity: sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg==} @@ -3897,6 +3904,7 @@ packages: /delayed-stream@1.0.0: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} + dev: false /delegates@1.0.0: resolution: {integrity: sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==} @@ -3986,6 +3994,7 @@ packages: engines: {node: '>=12'} dependencies: webidl-conversions: 7.0.0 + dev: false /domhandler@5.0.3: resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==} @@ -4662,6 +4671,7 @@ packages: asynckit: 0.4.0 combined-stream: 1.0.8 mime-types: 2.1.35 + dev: false /fraction.js@4.3.7: resolution: {integrity: sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==} @@ -5011,6 +5021,7 @@ packages: engines: {node: '>=12'} dependencies: whatwg-encoding: 2.0.0 + dev: false /html-escaper@2.0.2: resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} @@ -5042,6 +5053,7 @@ packages: debug: 4.3.4 transitivePeerDependencies: - supports-color + dev: false /http-proxy-agent@7.0.0: resolution: {integrity: sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==} @@ -5321,6 +5333,7 @@ packages: /is-potential-custom-element-name@1.0.1: resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==} + dev: false /is-primitive@3.0.1: resolution: {integrity: sha512-GljRxhWvlCNRfZyORiH77FwdFwGcMO620o37EOYC0ORWdq+WYNVqW0w2Juzew4M+L81l6/QS3t5gkkihyRqv9w==} @@ -5975,6 +5988,7 @@ packages: - bufferutil - supports-color - utf-8-validate + dev: false /jsesc@0.5.0: resolution: {integrity: sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==} @@ -6265,12 +6279,14 @@ packages: /mime-db@1.52.0: resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} engines: {node: '>= 0.6'} + dev: false /mime-types@2.1.35: resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} engines: {node: '>= 0.6'} dependencies: mime-db: 1.52.0 + dev: false /mime@1.6.0: resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==} @@ -6838,6 +6854,7 @@ packages: /nwsapi@2.2.7: resolution: {integrity: sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==} + dev: false /nypm@0.3.3: resolution: {integrity: sha512-FHoxtTscAE723e80d2M9cJRb4YVjL82Ra+ZV+YqC6rfNZUWahi+ZhPF+krnR+bdMvibsfHCtgKXnZf5R6kmEPA==} @@ -7087,6 +7104,7 @@ packages: resolution: {integrity: sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==} dependencies: entities: 4.5.0 + dev: false /parseurl@1.3.3: resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} @@ -7517,6 +7535,7 @@ packages: /psl@1.9.0: resolution: {integrity: sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==} + dev: false /punycode@2.3.1: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} @@ -7528,6 +7547,7 @@ packages: /querystringify@2.2.0: resolution: {integrity: sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==} + dev: false /queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} @@ -7668,6 +7688,7 @@ packages: /requires-port@1.0.0: resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==} + dev: false /resolve-cwd@3.0.0: resolution: {integrity: sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==} @@ -7785,6 +7806,7 @@ packages: /rrweb-cssom@0.6.0: resolution: {integrity: sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==} + dev: false /run-applescript@5.0.0: resolution: {integrity: sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==} @@ -7829,6 +7851,7 @@ packages: engines: {node: '>=v12.22.7'} dependencies: xmlchars: 2.2.0 + dev: false /scule@1.1.0: resolution: {integrity: sha512-vRUjqhyM/YWYzT+jsMk6tnl3NkY4A4soJ8uyh3O6Um+JXEQL9ozUCe7pqrxn3CSKokw0hw3nFStfskzpgYwR0g==} @@ -8261,6 +8284,7 @@ packages: /symbol-tree@3.2.4: resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} + dev: false /tapable@2.2.1: resolution: {integrity: sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==} @@ -8357,6 +8381,7 @@ packages: punycode: 2.3.1 universalify: 0.2.0 url-parse: 1.5.10 + dev: false /tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} @@ -8366,6 +8391,7 @@ packages: engines: {node: '>=14'} dependencies: punycode: 2.3.1 + dev: false /ts-api-utils@1.0.3(typescript@5.2.2): resolution: {integrity: sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==} @@ -8680,6 +8706,7 @@ packages: /universalify@0.2.0: resolution: {integrity: sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==} engines: {node: '>= 4.0.0'} + dev: false /universalify@2.0.1: resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} @@ -8823,6 +8850,7 @@ packages: dependencies: querystringify: 2.2.0 requires-port: 1.0.0 + dev: false /urlpattern-polyfill@8.0.2: resolution: {integrity: sha512-Qp95D4TPJl1kC9SKigDcqgyM2VDVO4RiJc2d4qe5GrYm+zbIQCWWKAFaJNQ4BhdFeDGwBmAxqJBwWSJDb9T3BQ==} @@ -9005,7 +9033,7 @@ packages: optionalDependencies: fsevents: 2.3.3 - /vitest@0.33.0(happy-dom@12.10.3)(jsdom@22.1.0): + /vitest@0.33.0: resolution: {integrity: sha512-1CxaugJ50xskkQ0e969R/hW47za4YXDUfWJDxip1hwbnhUjYolpfUn2AMOulqG/Dtd9WYAtkHmM/m3yKVrEejQ==} engines: {node: '>=v14.18.0'} hasBin: true @@ -9049,8 +9077,6 @@ packages: cac: 6.7.14 chai: 4.3.10 debug: 4.3.4 - happy-dom: 12.10.3 - jsdom: 22.1.0 local-pkg: 0.4.3 magic-string: 0.30.5 pathe: 1.1.1 @@ -9163,6 +9189,7 @@ packages: engines: {node: '>=14'} dependencies: xml-name-validator: 4.0.0 + dev: false /walker@1.0.8: resolution: {integrity: sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==} @@ -9200,6 +9227,7 @@ packages: dependencies: tr46: 4.1.1 webidl-conversions: 7.0.0 + dev: false /whatwg-url@5.0.0: resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} @@ -9317,6 +9345,7 @@ packages: /xmlchars@2.2.0: resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==} + dev: false /y18n@5.0.8: resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} From 87b0c7da125fc9e1b4e555fdba37b8f819f50457 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 21 Nov 2023 11:02:33 +0000 Subject: [PATCH 06/15] chore: remove error expectations --- src/nuxt-vitest/module.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/nuxt-vitest/module.ts b/src/nuxt-vitest/module.ts index aa68962a5..f707397c5 100644 --- a/src/nuxt-vitest/module.ts +++ b/src/nuxt-vitest/module.ts @@ -61,7 +61,6 @@ export default defineNuxtModule({ let testFiles: File[] | null = null const updateTabs = debounce(() => { - // @ts-expect-error TODO: fix nuxt.callHook('devtools:customTabs:refresh') }, 100) @@ -143,7 +142,6 @@ export default defineNuxtModule({ loaded = true } - // @ts-expect-error TODO: ensure devtools hook is typed nuxt.hook('devtools:customTabs', tabs => { const failedCount = testFiles?.filter(f => f.result?.state === 'fail').length ?? 0 From d5fc17a53ab02b06fc893512108e6262db5d6bf6 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 21 Nov 2023 11:04:12 +0000 Subject: [PATCH 07/15] ci: run prepare step --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b83fd8e82..2dfcb6e35 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,6 +85,9 @@ jobs: - name: Install Playwright run: pnpm playwright-core install chromium + - name: Build module + run: pnpm dev:prepare + - name: Build module run: pnpm prepack From 7ed2538ef5dc84e485ce4f16634d10cdd765243e Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 21 Nov 2023 11:07:10 +0000 Subject: [PATCH 08/15] ci: reorder prepare stages --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2dfcb6e35..215fa8698 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,14 +85,14 @@ jobs: - name: Install Playwright run: pnpm playwright-core install chromium - - name: Build module + - name: Prepare build environment run: pnpm dev:prepare - - name: Build module - run: pnpm prepack - - name: Prepare module environment run: pnpm -r dev:prepare + - name: Build module + run: pnpm prepack + - name: Test examples run: pnpm test:examples From bf5b4f4692df1395afae150d30f835e310c002a9 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 21 Nov 2023 11:59:33 +0000 Subject: [PATCH 09/15] ci: remove duplicate step --- .github/workflows/ci.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 215fa8698..a877e6083 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,9 +88,6 @@ jobs: - name: Prepare build environment run: pnpm dev:prepare - - name: Prepare module environment - run: pnpm -r dev:prepare - - name: Build module run: pnpm prepack From 3b19396103f62a2ad90b36da539aa4729bf46c2e Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 21 Nov 2023 11:59:59 +0000 Subject: [PATCH 10/15] fix: ensure devtools types are accessible at top level --- package.json | 1 + pnpm-lock.yaml | 3 +++ 2 files changed, 4 insertions(+) diff --git a/package.json b/package.json index 8a7b835c5..b1ef9db72 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ }, "devDependencies": { "@jest/globals": "29.7.0", + "@nuxt/devtools": "^1.0.3", "@nuxt/eslint-config": "0.2.0", "@nuxt/module-builder": "^0.5.2", "@testing-library/vue": "^7.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ace6cdd2d..f00a666cf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -79,6 +79,9 @@ importers: '@jest/globals': specifier: 29.7.0 version: 29.7.0 + '@nuxt/devtools': + specifier: ^1.0.3 + version: 1.0.3(nuxt@3.8.2)(rollup@3.29.4)(vite@4.5.0) '@nuxt/eslint-config': specifier: 0.2.0 version: 0.2.0(eslint@8.54.0) From 9630e35ed81e8ed0feb21e27ccfd31792571d850 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 21 Nov 2023 12:04:16 +0000 Subject: [PATCH 11/15] chore: move to package stub for publishing --- package.json | 2 +- pnpm-lock.yaml | 51 ++++++---------------- pnpm-workspace.yaml | 1 + stubs/vitest-environment-nuxt/package.json | 8 +++- stubs/vitest-environment-nuxt/utils.mjs | 1 + 5 files changed, 23 insertions(+), 40 deletions(-) create mode 100644 stubs/vitest-environment-nuxt/utils.mjs diff --git a/package.json b/package.json index b1ef9db72..71155a725 100644 --- a/package.json +++ b/package.json @@ -119,7 +119,7 @@ }, "resolutions": { "@nuxt/test-utils": "workspace:*", - "vitest-environment-nuxt": "link:./stubs/vitest-environment-nuxt" + "vitest-environment-nuxt": "workspace:*" }, "engines": { "node": "^14.18.0 || >=16.10.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f00a666cf..75166abc2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,7 +6,7 @@ settings: overrides: '@nuxt/test-utils': workspace:* - vitest-environment-nuxt: link:./stubs/vitest-environment-nuxt + vitest-environment-nuxt: workspace:* importers: @@ -144,7 +144,7 @@ importers: version: 4.5.0(@types/node@20.8.10) vitest: specifier: 0.33.0 - version: 0.33.0 + version: 0.33.0(happy-dom@12.10.3)(jsdom@22.1.0) vue-router: specifier: ^4.2.5 version: 4.2.5(vue@3.3.8) @@ -168,7 +168,7 @@ importers: specifier: ^12.10.3 version: 12.10.3 vitest-environment-nuxt: - specifier: link:../../stubs/vitest-environment-nuxt + specifier: workspace:* version: link:../../stubs/vitest-environment-nuxt examples/app-jest: @@ -234,9 +234,9 @@ importers: version: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0) vitest: specifier: 0.33.0 - version: 0.33.0 + version: 0.33.0(happy-dom@12.10.3)(jsdom@22.1.0) vitest-environment-nuxt: - specifier: link:../../stubs/vitest-environment-nuxt + specifier: workspace:* version: link:../../stubs/vitest-environment-nuxt examples/module/playground: @@ -252,6 +252,12 @@ importers: specifier: ^3.8.2 version: 3.8.2(@types/node@20.8.10)(eslint@8.54.0)(rollup@3.29.4)(typescript@5.2.2)(vite@4.5.0) + stubs/vitest-environment-nuxt: + dependencies: + '@nuxt/test-utils': + specifier: workspace:* + version: link:../.. + packages: /@aashutoshrathi/word-wrap@1.2.6: @@ -2312,7 +2318,6 @@ packages: /@tootallnate/once@2.0.0: resolution: {integrity: sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==} engines: {node: '>= 10'} - dev: false /@trysound/sax@0.2.0: resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==} @@ -2846,7 +2851,6 @@ packages: /abab@2.0.6: resolution: {integrity: sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==} - dev: false /abbrev@1.1.1: resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} @@ -3117,7 +3121,6 @@ packages: /asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} - dev: false /autoprefixer@10.4.16(postcss@8.4.31): resolution: {integrity: sha512-7vd3UC6xKp0HLfua5IjZlcXvGAGy7cBAXTg2lyQ/8WpNhd6SiZ8Be+xm3FyBSYJx5GKcpRCzBh7RH4/0dnY+uQ==} @@ -3547,7 +3550,6 @@ packages: engines: {node: '>= 0.8'} dependencies: delayed-stream: 1.0.0 - dev: false /commander@10.0.1: resolution: {integrity: sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==} @@ -3763,7 +3765,6 @@ packages: engines: {node: '>=14'} dependencies: rrweb-cssom: 0.6.0 - dev: false /csstype@3.1.2: resolution: {integrity: sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==} @@ -3775,7 +3776,6 @@ packages: abab: 2.0.6 whatwg-mimetype: 3.0.0 whatwg-url: 12.0.1 - dev: false /debug@2.6.9: resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} @@ -3811,7 +3811,6 @@ packages: /decimal.js@10.4.3: resolution: {integrity: sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==} - dev: false /dedent@1.5.1: resolution: {integrity: sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg==} @@ -3907,7 +3906,6 @@ packages: /delayed-stream@1.0.0: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} - dev: false /delegates@1.0.0: resolution: {integrity: sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==} @@ -3997,7 +3995,6 @@ packages: engines: {node: '>=12'} dependencies: webidl-conversions: 7.0.0 - dev: false /domhandler@5.0.3: resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==} @@ -4674,7 +4671,6 @@ packages: asynckit: 0.4.0 combined-stream: 1.0.8 mime-types: 2.1.35 - dev: false /fraction.js@4.3.7: resolution: {integrity: sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==} @@ -5024,7 +5020,6 @@ packages: engines: {node: '>=12'} dependencies: whatwg-encoding: 2.0.0 - dev: false /html-escaper@2.0.2: resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} @@ -5056,7 +5051,6 @@ packages: debug: 4.3.4 transitivePeerDependencies: - supports-color - dev: false /http-proxy-agent@7.0.0: resolution: {integrity: sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==} @@ -5336,7 +5330,6 @@ packages: /is-potential-custom-element-name@1.0.1: resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==} - dev: false /is-primitive@3.0.1: resolution: {integrity: sha512-GljRxhWvlCNRfZyORiH77FwdFwGcMO620o37EOYC0ORWdq+WYNVqW0w2Juzew4M+L81l6/QS3t5gkkihyRqv9w==} @@ -5991,7 +5984,6 @@ packages: - bufferutil - supports-color - utf-8-validate - dev: false /jsesc@0.5.0: resolution: {integrity: sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==} @@ -6282,14 +6274,12 @@ packages: /mime-db@1.52.0: resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} engines: {node: '>= 0.6'} - dev: false /mime-types@2.1.35: resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} engines: {node: '>= 0.6'} dependencies: mime-db: 1.52.0 - dev: false /mime@1.6.0: resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==} @@ -6857,7 +6847,6 @@ packages: /nwsapi@2.2.7: resolution: {integrity: sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==} - dev: false /nypm@0.3.3: resolution: {integrity: sha512-FHoxtTscAE723e80d2M9cJRb4YVjL82Ra+ZV+YqC6rfNZUWahi+ZhPF+krnR+bdMvibsfHCtgKXnZf5R6kmEPA==} @@ -7107,7 +7096,6 @@ packages: resolution: {integrity: sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==} dependencies: entities: 4.5.0 - dev: false /parseurl@1.3.3: resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} @@ -7538,7 +7526,6 @@ packages: /psl@1.9.0: resolution: {integrity: sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==} - dev: false /punycode@2.3.1: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} @@ -7550,7 +7537,6 @@ packages: /querystringify@2.2.0: resolution: {integrity: sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==} - dev: false /queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} @@ -7691,7 +7677,6 @@ packages: /requires-port@1.0.0: resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==} - dev: false /resolve-cwd@3.0.0: resolution: {integrity: sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==} @@ -7809,7 +7794,6 @@ packages: /rrweb-cssom@0.6.0: resolution: {integrity: sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==} - dev: false /run-applescript@5.0.0: resolution: {integrity: sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==} @@ -7854,7 +7838,6 @@ packages: engines: {node: '>=v12.22.7'} dependencies: xmlchars: 2.2.0 - dev: false /scule@1.1.0: resolution: {integrity: sha512-vRUjqhyM/YWYzT+jsMk6tnl3NkY4A4soJ8uyh3O6Um+JXEQL9ozUCe7pqrxn3CSKokw0hw3nFStfskzpgYwR0g==} @@ -8287,7 +8270,6 @@ packages: /symbol-tree@3.2.4: resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} - dev: false /tapable@2.2.1: resolution: {integrity: sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==} @@ -8384,7 +8366,6 @@ packages: punycode: 2.3.1 universalify: 0.2.0 url-parse: 1.5.10 - dev: false /tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} @@ -8394,7 +8375,6 @@ packages: engines: {node: '>=14'} dependencies: punycode: 2.3.1 - dev: false /ts-api-utils@1.0.3(typescript@5.2.2): resolution: {integrity: sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==} @@ -8709,7 +8689,6 @@ packages: /universalify@0.2.0: resolution: {integrity: sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==} engines: {node: '>= 4.0.0'} - dev: false /universalify@2.0.1: resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} @@ -8853,7 +8832,6 @@ packages: dependencies: querystringify: 2.2.0 requires-port: 1.0.0 - dev: false /urlpattern-polyfill@8.0.2: resolution: {integrity: sha512-Qp95D4TPJl1kC9SKigDcqgyM2VDVO4RiJc2d4qe5GrYm+zbIQCWWKAFaJNQ4BhdFeDGwBmAxqJBwWSJDb9T3BQ==} @@ -9036,7 +9014,7 @@ packages: optionalDependencies: fsevents: 2.3.3 - /vitest@0.33.0: + /vitest@0.33.0(happy-dom@12.10.3)(jsdom@22.1.0): resolution: {integrity: sha512-1CxaugJ50xskkQ0e969R/hW47za4YXDUfWJDxip1hwbnhUjYolpfUn2AMOulqG/Dtd9WYAtkHmM/m3yKVrEejQ==} engines: {node: '>=v14.18.0'} hasBin: true @@ -9080,6 +9058,8 @@ packages: cac: 6.7.14 chai: 4.3.10 debug: 4.3.4 + happy-dom: 12.10.3 + jsdom: 22.1.0 local-pkg: 0.4.3 magic-string: 0.30.5 pathe: 1.1.1 @@ -9192,7 +9172,6 @@ packages: engines: {node: '>=14'} dependencies: xml-name-validator: 4.0.0 - dev: false /walker@1.0.8: resolution: {integrity: sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==} @@ -9230,7 +9209,6 @@ packages: dependencies: tr46: 4.1.1 webidl-conversions: 7.0.0 - dev: false /whatwg-url@5.0.0: resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} @@ -9348,7 +9326,6 @@ packages: /xmlchars@2.2.0: resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==} - dev: false /y18n@5.0.8: resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 046698bf5..4cd7f012e 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,4 +1,5 @@ packages: - "examples/*" - "examples/module/playground" + - "stubs/*" - "text/fixtures/*" diff --git a/stubs/vitest-environment-nuxt/package.json b/stubs/vitest-environment-nuxt/package.json index 658b8f7d9..2e9683d59 100644 --- a/stubs/vitest-environment-nuxt/package.json +++ b/stubs/vitest-environment-nuxt/package.json @@ -1,8 +1,12 @@ { "type": "module", "name": "vitest-environment-nuxt", - "version": "0.0.0", + "version": "0.12.0", "exports": { - ".": "./index.mjs" + ".": "./index.mjs", + "./utils": "./utils.mjs" + }, + "dependencies": { + "@nuxt/test-utils": ">=3.9.0" } } diff --git a/stubs/vitest-environment-nuxt/utils.mjs b/stubs/vitest-environment-nuxt/utils.mjs new file mode 100644 index 000000000..e0dc483f3 --- /dev/null +++ b/stubs/vitest-environment-nuxt/utils.mjs @@ -0,0 +1 @@ +export * from '@nuxt/test-utils/runtime-utils' From c2f157d71edb1524338baf936a9561010121f8e8 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 21 Nov 2023 12:25:19 +0000 Subject: [PATCH 12/15] chore: move `vitest-environment-nuxt` stub to root --- examples/app/package.json | 3 +-- package.json | 3 ++- pnpm-lock.yaml | 6 +++--- test/fixtures/runtime/package.json | 1 - 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/examples/app/package.json b/examples/app/package.json index 9f49c4144..801b0eed1 100644 --- a/examples/app/package.json +++ b/examples/app/package.json @@ -17,7 +17,6 @@ }, "devDependencies": { "@nuxt/test-utils": "latest", - "happy-dom": "^12.10.3", - "vitest-environment-nuxt": "0.0.0" + "happy-dom": "^12.10.3" } } diff --git a/package.json b/package.json index 7f1bf65bf..04c04ce46 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,8 @@ "radix3": "^1.1.0", "std-env": "^3.5.0", "ufo": "^1.3.2", - "unenv": "^1.7.4" + "unenv": "^1.7.4", + "vitest-environment-nuxt": "0.12.0" }, "devDependencies": { "@jest/globals": "29.7.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bf48fb2a9..36b1b8594 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -72,6 +72,9 @@ importers: unenv: specifier: ^1.7.4 version: 1.7.4 + vitest-environment-nuxt: + specifier: workspace:* + version: link:stubs/vitest-environment-nuxt vue: specifier: ^3.3.4 version: 3.3.8(typescript@5.2.2) @@ -167,9 +170,6 @@ importers: happy-dom: specifier: ^12.10.3 version: 12.10.3 - vitest-environment-nuxt: - specifier: workspace:* - version: link:../../stubs/vitest-environment-nuxt examples/app-jest: dependencies: diff --git a/test/fixtures/runtime/package.json b/test/fixtures/runtime/package.json index 726a7fba0..dfdab0b41 100644 --- a/test/fixtures/runtime/package.json +++ b/test/fixtures/runtime/package.json @@ -23,7 +23,6 @@ "nuxt": "3.8.2", "typescript": "5.2.2", "vitest": "0.33.0", - "vitest-environment-nuxt": "0.0.0", "vue-tsc": "1.8.19" }, "version": "0.10.2", From 16ab0d947027974b88f7fcba5c96f934ccbdfcdc Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 21 Nov 2023 12:28:48 +0000 Subject: [PATCH 13/15] test: remove aliases --- test/fixtures/nuxt-vitest/nuxt.config.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/test/fixtures/nuxt-vitest/nuxt.config.ts b/test/fixtures/nuxt-vitest/nuxt.config.ts index 219ebea51..58a309580 100644 --- a/test/fixtures/nuxt-vitest/nuxt.config.ts +++ b/test/fixtures/nuxt-vitest/nuxt.config.ts @@ -15,16 +15,6 @@ export default defineNuxtConfig({ }, }, }, - // vite: { - // // TODO: fix bug with stubbing root package - // resolve: { - // alias: { - // '@nuxt/test-utils/config': '../../../src/config', - // '@nuxt/test-utils/module': '../../../src/module', - // '@nuxt/test-utils/runtime-utils': '../../../src/runtime-utils', - // }, - // }, - // }, imports: { injectAtEnd: true, }, From 194abc04bda7325aba751e40fe3c9c988ea0ceb6 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 21 Nov 2023 12:29:49 +0000 Subject: [PATCH 14/15] chore: remove alias + extra config file --- test/fixtures/nuxt-vitest/nuxt.config.ts | 26 ------------------------ test/fixtures/runtime/nuxt.config.ts | 10 --------- 2 files changed, 36 deletions(-) delete mode 100644 test/fixtures/nuxt-vitest/nuxt.config.ts diff --git a/test/fixtures/nuxt-vitest/nuxt.config.ts b/test/fixtures/nuxt-vitest/nuxt.config.ts deleted file mode 100644 index 58a309580..000000000 --- a/test/fixtures/nuxt-vitest/nuxt.config.ts +++ /dev/null @@ -1,26 +0,0 @@ -// https://v3.nuxtjs.org/api/configuration/nuxt.config -export default defineNuxtConfig({ - modules: ['@nuxt/test-utils/module', '@nuxt/devtools', '~/modules/custom'], - vitest: { - startOnBoot: true, - logToConsole: true, - vitestConfig: { - setupFiles: ['./tests/setup/mocks'], - environmentOptions: { - nuxt: { - mock: { - indexedDb: true, - }, - }, - }, - }, - }, - imports: { - injectAtEnd: true, - }, - runtimeConfig: { - public: { - hello: 'world', - }, - }, -}) diff --git a/test/fixtures/runtime/nuxt.config.ts b/test/fixtures/runtime/nuxt.config.ts index 1f9b9617e..58a309580 100644 --- a/test/fixtures/runtime/nuxt.config.ts +++ b/test/fixtures/runtime/nuxt.config.ts @@ -15,16 +15,6 @@ export default defineNuxtConfig({ }, }, }, - vite: { - // TODO: fix bug with stubbing root package - resolve: { - alias: { - '@nuxt/test-utils/config': '../../../src/config', - '@nuxt/test-utils/module': '../../../src/module', - '@nuxt/test-utils/runtime-utils': '../../../src/utils', - }, - }, - }, imports: { injectAtEnd: true, }, From 98b12557c1c275d77484c19599805b1d205f0453 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 21 Nov 2023 12:30:43 +0000 Subject: [PATCH 15/15] test: fix import --- test/fixtures/runtime/vitest.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixtures/runtime/vitest.config.ts b/test/fixtures/runtime/vitest.config.ts index b18e2263d..dcbd3fc3f 100644 --- a/test/fixtures/runtime/vitest.config.ts +++ b/test/fixtures/runtime/vitest.config.ts @@ -1,5 +1,5 @@ import { fileURLToPath } from 'node:url' -import { defineVitestConfig } from '../../../src/config' +import { defineVitestConfig } from '@nuxt/test-utils/config' export default defineVitestConfig({ test: {