From 18ea4d11d37d415df987487e4250bc088f501788 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 2 Aug 2023 08:37:17 +0000 Subject: [PATCH 1/3] chore(deps): update vitest monorepo to v0.34.1 --- package.json | 4 +-- pnpm-lock.yaml | 70 +++++++++++++++++++++++++------------------------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/package.json b/package.json index cf9700018..77cc93435 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "@types/jsdom": "21.1.1", "@typescript-eslint/eslint-plugin": "6.2.1", "@typescript-eslint/parser": "6.2.1", - "@vitest/ui": "0.33.0", + "@vitest/ui": "0.34.1", "autoprefixer": "10.4.14", "eslint": "8.46.0", "eslint-config-prettier": "8.9.0", @@ -85,7 +85,7 @@ "typescript": "5.1.6", "unist-util-visit": "5.0.0", "unplugin-icons": "0.16.5", - "vitest": "0.33.0" + "vitest": "0.34.1" }, "peerDependencies": { "jsdom": "^16.4.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 10ed3ea0b..fe8315e2d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -68,8 +68,8 @@ devDependencies: specifier: 6.2.1 version: 6.2.1(eslint@8.46.0)(typescript@5.1.6) '@vitest/ui': - specifier: 0.33.0 - version: 0.33.0(vitest@0.33.0) + specifier: 0.34.1 + version: 0.34.1(vitest@0.34.1) autoprefixer: specifier: 10.4.14 version: 10.4.14(postcss@8.4.27) @@ -164,8 +164,8 @@ devDependencies: specifier: 0.16.5 version: 0.16.5 vitest: - specifier: 0.33.0 - version: 0.33.0(@vitest/ui@0.33.0)(jsdom@22.0.0) + specifier: 0.34.1 + version: 0.34.1(@vitest/ui@0.34.1)(jsdom@22.0.0) packages: @@ -1497,53 +1497,53 @@ packages: eslint-visitor-keys: 3.4.2 dev: true - /@vitest/expect@0.33.0: - resolution: {integrity: sha512-sVNf+Gla3mhTCxNJx+wJLDPp/WcstOe0Ksqz4Vec51MmgMth/ia0MGFEkIZmVGeTL5HtjYR4Wl/ZxBxBXZJTzQ==} + /@vitest/expect@0.34.1: + resolution: {integrity: sha512-q2CD8+XIsQ+tHwypnoCk8Mnv5e6afLFvinVGCq3/BOT4kQdVQmY6rRfyKkwcg635lbliLPqbunXZr+L1ssUWiQ==} dependencies: - '@vitest/spy': 0.33.0 - '@vitest/utils': 0.33.0 + '@vitest/spy': 0.34.1 + '@vitest/utils': 0.34.1 chai: 4.3.7 dev: true - /@vitest/runner@0.33.0: - resolution: {integrity: sha512-UPfACnmCB6HKRHTlcgCoBh6ppl6fDn+J/xR8dTufWiKt/74Y9bHci5CKB8tESSV82zKYtkBJo9whU3mNvfaisg==} + /@vitest/runner@0.34.1: + resolution: {integrity: sha512-YfQMpYzDsYB7yqgmlxZ06NI4LurHWfrH7Wy3Pvf/z/vwUSgq1zLAb1lWcItCzQG+NVox+VvzlKQrYEXb47645g==} dependencies: - '@vitest/utils': 0.33.0 + '@vitest/utils': 0.34.1 p-limit: 4.0.0 pathe: 1.1.1 dev: true - /@vitest/snapshot@0.33.0: - resolution: {integrity: sha512-tJjrl//qAHbyHajpFvr8Wsk8DIOODEebTu7pgBrP07iOepR5jYkLFiqLq2Ltxv+r0uptUb4izv1J8XBOwKkVYA==} + /@vitest/snapshot@0.34.1: + resolution: {integrity: sha512-0O9LfLU0114OqdF8lENlrLsnn024Tb1CsS9UwG0YMWY2oGTQfPtkW+B/7ieyv0X9R2Oijhi3caB1xgGgEgclSQ==} dependencies: magic-string: 0.30.1 pathe: 1.1.1 pretty-format: 29.6.1 dev: true - /@vitest/spy@0.33.0: - resolution: {integrity: sha512-Kv+yZ4hnH1WdiAkPUQTpRxW8kGtH8VRTnus7ZTGovFYM1ZezJpvGtb9nPIjPnptHbsyIAxYZsEpVPYgtpjGnrg==} + /@vitest/spy@0.34.1: + resolution: {integrity: sha512-UT4WcI3EAPUNO8n6y9QoEqynGGEPmmRxC+cLzneFFXpmacivjHZsNbiKD88KUScv5DCHVDgdBsLD7O7s1enFcQ==} dependencies: tinyspy: 2.1.1 dev: true - /@vitest/ui@0.33.0(vitest@0.33.0): - resolution: {integrity: sha512-7gbAjLqt30R4bodkJAutdpy4ncv+u5IKTHYTow1c2q+FOxZUC9cKOSqMUxjwaaTwLN+EnDnmXYPtg3CoahaUzQ==} + /@vitest/ui@0.34.1(vitest@0.34.1): + resolution: {integrity: sha512-bwmkgMjDcMr3pg0UXLwfwZ/WI1fq2N+5DUisqHkY9bvnNRnpT6QiewtSS/VhmN61ixgNpSKbEGVboml2GLuxfA==} peerDependencies: vitest: '>=0.30.1 <1' dependencies: - '@vitest/utils': 0.33.0 + '@vitest/utils': 0.34.1 fast-glob: 3.3.0 fflate: 0.8.0 flatted: 3.2.7 pathe: 1.1.1 picocolors: 1.0.0 sirv: 2.0.3 - vitest: 0.33.0(@vitest/ui@0.33.0)(jsdom@22.0.0) + vitest: 0.34.1(@vitest/ui@0.34.1)(jsdom@22.0.0) dev: true - /@vitest/utils@0.33.0: - resolution: {integrity: sha512-pF1w22ic965sv+EN6uoePkAOTkAPWM03Ri/jXNyMIKBb/XHLDPfhLvf/Fa9g0YECevAIz56oVYXhodLvLQ/awA==} + /@vitest/utils@0.34.1: + resolution: {integrity: sha512-/ql9dsFi4iuEbiNcjNHQWXBum7aL8pyhxvfnD9gNtbjR9fUKAjxhj4AA3yfLXg6gJpMGGecvtF8Au2G9y3q47Q==} dependencies: diff-sequences: 29.4.3 loupe: 2.3.6 @@ -5474,8 +5474,8 @@ packages: resolution: {integrity: sha512-kRwSG8Zx4tjF9ZiyH4bhaebu+EDz1BOx9hOigYHlUW4xxI/wKIUQUqo018UlU4ar6ATPBsaMrdbKZ+tmPdohFA==} dev: true - /tinypool@0.6.0: - resolution: {integrity: sha512-FdswUUo5SxRizcBc6b1GSuLpLjisa8N8qMyYoP3rl+bym+QauhtJP5bvZY1ytt8krKGmMLYIRl36HBZfeAoqhQ==} + /tinypool@0.7.0: + resolution: {integrity: sha512-zSYNUlYSMhJ6Zdou4cJwo/p7w5nmAH17GRfU/ui3ctvjXFErXXkruT4MWW6poDeXgCaIBlGLrfU6TbTXxyGMww==} engines: {node: '>=14.0.0'} dev: true @@ -5846,8 +5846,8 @@ packages: vfile-message: 3.1.2 dev: true - /vite-node@0.33.0(@types/node@18.13.0): - resolution: {integrity: sha512-19FpHYbwWWxDr73ruNahC+vtEdza52kA90Qb3La98yZ0xULqV8A5JLNPUff0f5zID4984tW7l3DH2przTJUZSw==} + /vite-node@0.34.1(@types/node@18.13.0): + resolution: {integrity: sha512-odAZAL9xFMuAg8aWd7nSPT+hU8u2r9gU3LRm9QKjxBEF2rRdWpMuqkrkjvyVQEdNFiBctqr2Gg4uJYizm5Le6w==} engines: {node: '>=v14.18.0'} hasBin: true dependencies: @@ -5911,8 +5911,8 @@ packages: vite: 4.1.5(@types/node@18.13.0) dev: true - /vitest@0.33.0(@vitest/ui@0.33.0)(jsdom@22.0.0): - resolution: {integrity: sha512-1CxaugJ50xskkQ0e969R/hW47za4YXDUfWJDxip1hwbnhUjYolpfUn2AMOulqG/Dtd9WYAtkHmM/m3yKVrEejQ==} + /vitest@0.34.1(@vitest/ui@0.34.1)(jsdom@22.0.0): + resolution: {integrity: sha512-G1PzuBEq9A75XSU88yO5G4vPT20UovbC/2osB2KEuV/FisSIIsw7m5y2xMdB7RsAGHAfg2lPmp2qKr3KWliVlQ==} engines: {node: '>=v14.18.0'} hasBin: true peerDependencies: @@ -5945,12 +5945,12 @@ packages: '@types/chai': 4.3.5 '@types/chai-subset': 1.3.3 '@types/node': 18.13.0 - '@vitest/expect': 0.33.0 - '@vitest/runner': 0.33.0 - '@vitest/snapshot': 0.33.0 - '@vitest/spy': 0.33.0 - '@vitest/ui': 0.33.0(vitest@0.33.0) - '@vitest/utils': 0.33.0 + '@vitest/expect': 0.34.1 + '@vitest/runner': 0.34.1 + '@vitest/snapshot': 0.34.1 + '@vitest/spy': 0.34.1 + '@vitest/ui': 0.34.1(vitest@0.34.1) + '@vitest/utils': 0.34.1 acorn: 8.9.0 acorn-walk: 8.2.0 cac: 6.7.14 @@ -5964,9 +5964,9 @@ packages: std-env: 3.3.3 strip-literal: 1.0.1 tinybench: 2.5.0 - tinypool: 0.6.0 + tinypool: 0.7.0 vite: 4.1.5(@types/node@18.13.0) - vite-node: 0.33.0(@types/node@18.13.0) + vite-node: 0.34.1(@types/node@18.13.0) why-is-node-running: 2.2.2 transitivePeerDependencies: - less From 783937d6eab6ae30a96b6debf4c4d11392df4ee2 Mon Sep 17 00:00:00 2001 From: Sebastian Friedel Date: Wed, 2 Aug 2023 13:00:57 +0200 Subject: [PATCH 2/3] test: remove unsupported transformMode config in ssr tests --- vitest.ssr.config.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/vitest.ssr.config.ts b/vitest.ssr.config.ts index 3c30f16f6..e580d7268 100644 --- a/vitest.ssr.config.ts +++ b/vitest.ssr.config.ts @@ -7,9 +7,6 @@ export default defineConfig({ test: { environment: 'node', include: ['tests/ssr/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], - setupFiles: 'tests/setup.js', - transformMode: { - ssr: [/\.([cm]?[jt]sx?|json|svelte)$/] - } + setupFiles: 'tests/setup.js' } }); From b93f20de54b7ca15e53f6ed3b93eef203e401d15 Mon Sep 17 00:00:00 2001 From: Sebastian Friedel Date: Wed, 2 Aug 2023 13:45:34 +0200 Subject: [PATCH 3/3] test: compatibility with vitest >=0.34 Moves tests to src/tests due to imports otherwise failing in jsdom environment. Also migrates to unified vitest config for dom and ssr environments. --- package.json | 4 +--- .../tests}/dom/__snapshots__/e2e.test.js.snap | 0 .../dom/__snapshots__/examples.test.js.snap | 0 {tests => src/tests}/dom/e2e.test.js | 4 ++-- {tests => src/tests}/dom/examples.test.js | 0 {tests => src/tests}/setup.js | 0 .../tests}/ssr/__snapshots__/e2e.test.js.snap | 0 .../ssr/__snapshots__/examples.test.js.snap | 0 {tests => src/tests}/ssr/e2e.test.js | 4 ++-- {tests => src/tests}/ssr/examples.test.js | 0 svelte.config.js | 2 +- .../regression-tests.test.js.snap | 12 ------------ .../regression-tests.test.js.snap | 12 ------------ vite.config.js | 19 +++++++++++++------ vitest.config.ts | 11 ----------- vitest.ssr.config.ts | 12 ------------ 16 files changed, 19 insertions(+), 61 deletions(-) rename {tests => src/tests}/dom/__snapshots__/e2e.test.js.snap (100%) rename {tests => src/tests}/dom/__snapshots__/examples.test.js.snap (100%) rename {tests => src/tests}/dom/e2e.test.js (81%) rename {tests => src/tests}/dom/examples.test.js (100%) rename {tests => src/tests}/setup.js (100%) rename {tests => src/tests}/ssr/__snapshots__/e2e.test.js.snap (100%) rename {tests => src/tests}/ssr/__snapshots__/examples.test.js.snap (100%) rename {tests => src/tests}/ssr/e2e.test.js (79%) rename {tests => src/tests}/ssr/examples.test.js (100%) delete mode 100644 tests/dom/__snapshots__/regression-tests.test.js.snap delete mode 100644 tests/ssr/__snapshots__/regression-tests.test.js.snap delete mode 100644 vitest.config.ts delete mode 100644 vitest.ssr.config.ts diff --git a/package.json b/package.json index 77cc93435..d55dade33 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,7 @@ "check:watch": "svelte-check --tsconfig ./tsconfig.json --watch", "lint": "prettier --check . && eslint .", "format": "prettier --write .", - "test": "run-s test:*", - "test:dom": "vitest --run", - "test:ssr": "vitest -c vitest.ssr.config.ts --run", + "test": "vitest", "prepublishOnly": "npm run package" }, "dependencies": { diff --git a/tests/dom/__snapshots__/e2e.test.js.snap b/src/tests/dom/__snapshots__/e2e.test.js.snap similarity index 100% rename from tests/dom/__snapshots__/e2e.test.js.snap rename to src/tests/dom/__snapshots__/e2e.test.js.snap diff --git a/tests/dom/__snapshots__/examples.test.js.snap b/src/tests/dom/__snapshots__/examples.test.js.snap similarity index 100% rename from tests/dom/__snapshots__/examples.test.js.snap rename to src/tests/dom/__snapshots__/examples.test.js.snap diff --git a/tests/dom/e2e.test.js b/src/tests/dom/e2e.test.js similarity index 81% rename from tests/dom/e2e.test.js rename to src/tests/dom/e2e.test.js index 84c20c4b8..cd45eab33 100644 --- a/tests/dom/e2e.test.js +++ b/src/tests/dom/e2e.test.js @@ -6,10 +6,10 @@ afterEach(async () => { cleanup(); }); -const testComponents = import.meta.glob('../../src/e2e/**/Test.svelte'); +const testComponents = import.meta.glob('../../e2e/**/Test.svelte'); export const tests = Object.entries(testComponents).map(([name, mod]) => ({ - name: name.replace('../../src/e2e/', ''), + name: name.replace('../../e2e/', ''), module: mod })); diff --git a/tests/dom/examples.test.js b/src/tests/dom/examples.test.js similarity index 100% rename from tests/dom/examples.test.js rename to src/tests/dom/examples.test.js diff --git a/tests/setup.js b/src/tests/setup.js similarity index 100% rename from tests/setup.js rename to src/tests/setup.js diff --git a/tests/ssr/__snapshots__/e2e.test.js.snap b/src/tests/ssr/__snapshots__/e2e.test.js.snap similarity index 100% rename from tests/ssr/__snapshots__/e2e.test.js.snap rename to src/tests/ssr/__snapshots__/e2e.test.js.snap diff --git a/tests/ssr/__snapshots__/examples.test.js.snap b/src/tests/ssr/__snapshots__/examples.test.js.snap similarity index 100% rename from tests/ssr/__snapshots__/examples.test.js.snap rename to src/tests/ssr/__snapshots__/examples.test.js.snap diff --git a/tests/ssr/e2e.test.js b/src/tests/ssr/e2e.test.js similarity index 79% rename from tests/ssr/e2e.test.js rename to src/tests/ssr/e2e.test.js index d96af2bc9..bc13cea0c 100644 --- a/tests/ssr/e2e.test.js +++ b/src/tests/ssr/e2e.test.js @@ -2,10 +2,10 @@ import { describe, it, expect, vi } from 'vitest'; vi.stubGlobal('navigator', { languages: [] }); -const testComponents = import.meta.glob('../../src/e2e/**/Test.svelte'); +const testComponents = import.meta.glob('../../e2e/**/Test.svelte'); export const tests = Object.entries(testComponents).map(([name, mod]) => ({ - name: name.replace('../../src/e2e/', ''), + name: name.replace('../../e2e/', ''), module: mod })); diff --git a/tests/ssr/examples.test.js b/src/tests/ssr/examples.test.js similarity index 100% rename from tests/ssr/examples.test.js rename to src/tests/ssr/examples.test.js diff --git a/svelte.config.js b/svelte.config.js index 64295090f..ec609abcd 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -3,7 +3,7 @@ import mdsvexConfig from './mdsvex.config.js'; import adapter from '@sveltejs/adapter-static'; import { vitePreprocess } from '@sveltejs/kit/vite'; -/** @type {import('@sveltejs/package').Config} */ +/** @type {import('@sveltejs/kit').Config} */ const config = { extensions: ['.svelte', ...mdsvexConfig.extensions], diff --git a/tests/dom/__snapshots__/regression-tests.test.js.snap b/tests/dom/__snapshots__/regression-tests.test.js.snap deleted file mode 100644 index 62d510266..000000000 --- a/tests/dom/__snapshots__/regression-tests.test.js.snap +++ /dev/null @@ -1,12 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`Regression test empty-pattern-with-attributes/Test.svelte > should render 1`] = ` - -
- Some text - - - -
- -`; diff --git a/tests/ssr/__snapshots__/regression-tests.test.js.snap b/tests/ssr/__snapshots__/regression-tests.test.js.snap deleted file mode 100644 index 323e0baca..000000000 --- a/tests/ssr/__snapshots__/regression-tests.test.js.snap +++ /dev/null @@ -1,12 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`Regression test empty-pattern-with-attributes/Test.svelte > should render 1`] = ` -{ - "css": { - "code": "", - "map": null, - }, - "head": "", - "html": "Some text", -} -`; diff --git a/vite.config.js b/vite.config.js index b49c1eba0..1c0a9818a 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,10 +1,11 @@ +/// import { sveltekit } from '@sveltejs/kit/vite'; import Icons from 'unplugin-icons/vite'; +import { defineConfig } from 'vite'; import ssrResolvePlugin from './src/site/plugin'; import highlightPlugin from './utils/highlight-plugin'; -/** @type {import('vite').UserConfig} */ -const config = { +export default defineConfig({ plugins: [ ssrResolvePlugin(), highlightPlugin(), @@ -13,7 +14,13 @@ const config = { compiler: 'svelte', autoInstall: true }) - ] -}; - -export default config; + ], + test: { + environmentMatchGlobs: [ + ['src/tests/dom/**', 'jsdom'], + ['src/tests/ssr/**', 'node'] + ], + include: ['src/tests/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], + setupFiles: 'src/tests/setup.js' + } +}); diff --git a/vitest.config.ts b/vitest.config.ts deleted file mode 100644 index 88e2855e1..000000000 --- a/vitest.config.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { defineConfig } from 'vitest/config'; -import { sveltekit } from '@sveltejs/kit/vite'; - -export default defineConfig({ - plugins: [sveltekit()], - test: { - environment: 'jsdom', - include: ['tests/dom/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], - setupFiles: 'tests/setup.js' - } -}); diff --git a/vitest.ssr.config.ts b/vitest.ssr.config.ts deleted file mode 100644 index e580d7268..000000000 --- a/vitest.ssr.config.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { defineConfig } from 'vitest/config'; -import { sveltekit } from '@sveltejs/kit/vite'; -import ssrResolvePlugin from './src/site/plugin'; - -export default defineConfig({ - plugins: [sveltekit(), ssrResolvePlugin()], - test: { - environment: 'node', - include: ['tests/ssr/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], - setupFiles: 'tests/setup.js' - } -});