From 4e2f8b8324d6e1ea13b3781dcca0c9c9021608b8 Mon Sep 17 00:00:00 2001 From: f-elix Date: Thu, 28 Nov 2024 17:27:40 -0500 Subject: [PATCH] Adjust tests --- packages/components/dismissable/vitest.config.js | 3 ++- packages/components/sprite-animation/package.json | 5 +++-- .../sprite-animation/test/SpriteAnimation.spec.ts | 2 +- packages/components/sprite-animation/test/setup.ts | 1 + packages/components/sprite-animation/vitest.config.js | 6 +++--- pnpm-lock.yaml | 10 ++++++++++ 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/packages/components/dismissable/vitest.config.js b/packages/components/dismissable/vitest.config.js index d7b1f54a..bb9613a1 100644 --- a/packages/components/dismissable/vitest.config.js +++ b/packages/components/dismissable/vitest.config.js @@ -1,5 +1,6 @@ import { svelteInlineComponent } from '@288-toolkit/vite-plugin-svelte-inline-component'; import { sveltekit } from '@sveltejs/kit/vite'; +import { svelteTesting } from '@testing-library/svelte/vite'; import { defineProject, mergeConfig } from 'vitest/config'; import baseConfig from '../../../vitest.shared'; @@ -10,6 +11,6 @@ export default mergeConfig( setupFiles: ['./test/setup.ts'], alias: [{ find: /^svelte$/, replacement: 'svelte/internal' }] }, - plugins: [sveltekit(), svelteInlineComponent()] + plugins: [sveltekit(), svelteTesting(), svelteInlineComponent()] }) ); diff --git a/packages/components/sprite-animation/package.json b/packages/components/sprite-animation/package.json index 31809129..e879aac7 100644 --- a/packages/components/sprite-animation/package.json +++ b/packages/components/sprite-animation/package.json @@ -28,8 +28,8 @@ } }, "peerDependencies": { - "svelte": "5.x", - "motion": "10.x" + "motion": "10.x", + "svelte": "5.x" }, "dependencies": { "@288-toolkit/device": "workspace:^", @@ -38,6 +38,7 @@ }, "devDependencies": { "@288-toolkit/vite-plugin-svelte-inline-component": "workspace:^", + "@testing-library/jest-dom": "^6.6.3", "@testing-library/svelte": "^5.1.0", "svelte-preprocess": "^6.0.0" } diff --git a/packages/components/sprite-animation/test/SpriteAnimation.spec.ts b/packages/components/sprite-animation/test/SpriteAnimation.spec.ts index 98120586..a2ac0491 100644 --- a/packages/components/sprite-animation/test/SpriteAnimation.spec.ts +++ b/packages/components/sprite-animation/test/SpriteAnimation.spec.ts @@ -1,4 +1,4 @@ -import { render } from '@testing-library/svelte'; +import { render } from '@testing-library/svelte/svelte5'; import { afterEach, beforeEach, expect, test, vi } from 'vitest'; import SpriteAnimation from '../src/lib/SpriteAnimation.svelte'; diff --git a/packages/components/sprite-animation/test/setup.ts b/packages/components/sprite-animation/test/setup.ts index 8167d143..1597d167 100644 --- a/packages/components/sprite-animation/test/setup.ts +++ b/packages/components/sprite-animation/test/setup.ts @@ -1 +1,2 @@ +import '@testing-library/jest-dom/vitest'; import '../../../../shared/test/mocks/sveltekit'; diff --git a/packages/components/sprite-animation/vitest.config.js b/packages/components/sprite-animation/vitest.config.js index d7b1f54a..d61884b8 100644 --- a/packages/components/sprite-animation/vitest.config.js +++ b/packages/components/sprite-animation/vitest.config.js @@ -1,5 +1,6 @@ import { svelteInlineComponent } from '@288-toolkit/vite-plugin-svelte-inline-component'; import { sveltekit } from '@sveltejs/kit/vite'; +import { svelteTesting } from '@testing-library/svelte/vite'; import { defineProject, mergeConfig } from 'vitest/config'; import baseConfig from '../../../vitest.shared'; @@ -7,9 +8,8 @@ export default mergeConfig( baseConfig, defineProject({ test: { - setupFiles: ['./test/setup.ts'], - alias: [{ find: /^svelte$/, replacement: 'svelte/internal' }] + setupFiles: ['./test/setup.ts'] }, - plugins: [sveltekit(), svelteInlineComponent()] + plugins: [sveltekit(), svelteTesting(), svelteInlineComponent()] }) ); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 263f35e9..14c03ef7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -311,6 +311,9 @@ importers: '@288-toolkit/vite-plugin-svelte-inline-component': specifier: workspace:^ version: link:../../vite-plugin-svelte-inline-component + '@testing-library/jest-dom': + specifier: ^6.6.3 + version: 6.6.3 '@testing-library/svelte': specifier: ^5.1.0 version: 5.1.0(svelte@4.0.0)(vite@5.2.11(@types/node@20.12.7))(vitest@2.1.6(@types/node@20.12.7)(jsdom@24.0.0)) @@ -634,6 +637,9 @@ importers: packages: + '@adobe/css-tools@4.4.1': + resolution: {integrity: sha512-12WGKBQzjUAI4ayyF4IAtfw2QR/IDoqk6jTddXDhtYTJF9ASmoE1zst7cVtP0aL/F1jUJL5r+JxKXKEgHNbEUQ==} + '@adobe/css-tools@4.4.1': resolution: {integrity: sha512-12WGKBQzjUAI4ayyF4IAtfw2QR/IDoqk6jTddXDhtYTJF9ASmoE1zst7cVtP0aL/F1jUJL5r+JxKXKEgHNbEUQ==} @@ -3710,6 +3716,8 @@ snapshots: '@adobe/css-tools@4.4.1': {} + '@adobe/css-tools@4.4.1': {} + '@ampproject/remapping@2.3.0': dependencies: '@jridgewell/gen-mapping': 0.3.5 @@ -4997,6 +5005,8 @@ snapshots: css.escape@1.5.1: {} + css.escape@1.5.1: {} + cssesc@3.0.0: {} cssstyle@4.1.0: