Skip to content

Commit bf05913

Browse files
committed
Setup Vitest to run with the storybook 9
1 parent ca8b68e commit bf05913

79 files changed

Lines changed: 480 additions & 153 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,5 @@ instructive-docs
9999

100100
#cursor
101101
.cursor
102+
103+
**/__screenshots__

packages/config/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"@types/node": "^22.15.3",
4545
"@typescript-eslint/eslint-plugin": "^8.31.1",
4646
"@typescript-eslint/parser": "^8.31.1",
47-
"@vitest/coverage-v8": "^3.1.2",
47+
"@vitest/coverage-v8": "3.2.1",
4848
"debug": "^4.4.0",
4949
"eslint": "^9.25.1",
5050
"eslint-config-eslint": "^11.0.0",

packages/config/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"compilerOptions": {
3-
"types": ["node", "@testing-library/dom", "vitest/globals"],
43
"target": "ESNext",
54
"lib": ["dom", "dom.iterable", "esnext"],
65
"allowJs": true,

packages/integrations/vitest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'
33

44
export default defineConfig({
55
test: {
6+
name: 'integrations',
67
globals: true,
78
environment: 'jsdom',
89
setupFiles: [resolve(__dirname, 'test/setup')],
Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
// import { setProjectAnnotations } from '@storybook/experimental-nextjs-vite'
2-
// import { beforeAll } from 'vitest'
1+
import { setProjectAnnotations } from '@storybook/react-vite';
2+
import * as projectAnnotations from './preview';
33

4-
// import * as projectAnnotations from './preview'
5-
6-
if (process.env.NODE_ENV === 'test') {
7-
console.info('Vitest environment loaded')
8-
// This is an important step to apply the right configuration when testing your stories.
9-
// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
10-
// const project = setProjectAnnotations([projectAnnotations])
11-
12-
// beforeAll(project.beforeAll)
13-
}
4+
// This is an important step to apply the right configuration when testing your stories.
5+
// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
6+
setProjectAnnotations([projectAnnotations]);

packages/ui/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,22 @@
5252
"@solana-foundation/ms-tools-config": "workspace:^",
5353
"@storybook/csf": "^0.1.13",
5454
"@storybook/manager-api": "^8.6.14",
55+
"@storybook/testing-react": "^2.0.1",
5556
"@storybook/theming": "^8.6.14",
5657
"@tailwindcss/postcss": "^4.1.5",
57-
"@testing-library/dom": "^10.4.0",
58+
"@vitejs/plugin-react": "^4.5.1",
5859
"class-variance-authority": "^0.7.1",
5960
"clsx": "^2.1.1",
6061
"dom": "link:@types/@testing-library/dom",
62+
"jsdom": "^26.1.0",
6163
"lucide-react": "^0.511.0",
6264
"next-themes": "^0.4.6",
6365
"postcss": "^8.4.31",
6466
"react-hook-form": "^7.56.4",
6567
"sonner": "^2.0.3",
6668
"tailwind-merge": "^3.2.0",
6769
"tailwindcss": "^4.1.5",
70+
"testing-react": "link:@types/@storybook/testing-react",
6871
"vaul": "^1.1.2",
6972
"zod": "^3.25.30"
7073
},
@@ -79,9 +82,10 @@
7982
"@storybook/react": "^9.0.4",
8083
"@storybook/react-vite": "^9.0.4",
8184
"@storybook/test": "^8.6.14",
85+
"@testing-library/dom": "^10.4.0",
8286
"@testing-library/jest-dom": "^6.6.3",
8387
"@testing-library/react": "^16.3.0",
84-
"@types/node": "^22.15.29",
88+
"@types/node": "^22.15.3",
8589
"@types/react": "^19.1.2",
8690
"@vitest/browser": "3.2.1",
8791
"@vitest/coverage-v8": "3.2.1",

0 commit comments

Comments
 (0)