diff --git a/src/components/forms/Input.stories.tsx b/src/components/forms/Input.stories.tsx index 4c99ebe5..d52358e0 100644 --- a/src/components/forms/Input.stories.tsx +++ b/src/components/forms/Input.stories.tsx @@ -1,10 +1,14 @@ import type { Meta, StoryObj } from '@storybook/react' import { Input } from './Input' +import { fn } from '@storybook/test' const meta = { title: 'Components/Form/Input', component: Input, + args: { + onChange: fn(), + }, parameters: { design: { type: 'figma', diff --git a/storybook.setup.ts b/storybook.setup.ts index 76d3d56e..5f35d37a 100644 --- a/storybook.setup.ts +++ b/storybook.setup.ts @@ -1,7 +1,9 @@ -// import 'vitest-canvas-mock' -// const { getComputedStyle } = window -// window.getComputedStyle = (elt) => getComputedStyle(elt) -// window.scrollTo = () => {} +if(!globalThis.__vitest_browser__) { + await import('vitest-canvas-mock') + const { getComputedStyle } = window + window.getComputedStyle = (elt) => getComputedStyle(elt) + window.scrollTo = () => {} +} import { setProjectAnnotations } from '@storybook/react' import storybookAnnotations from './.storybook/preview' diff --git a/vitest.config.ts b/vitest.config.ts index 2507f657..17bf7fe1 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -2,7 +2,7 @@ import { defineConfig } from 'vitest/config' import { mergeConfig } from 'vite' import { storybookTest } from '@storybook/experimental-addon-vitest/plugin' -import Inspect from 'vite-plugin-inspect' +// import Inspect from 'vite-plugin-inspect' import viteConfig from './vite.config' @@ -14,12 +14,12 @@ export default mergeConfig( storybookTest({ storybookScript: 'yarn storybook --ci' }), - Inspect({ - build: true, - open: true, - include: [ '**/*.stories.*'], - dev: false, - }) + // Inspect({ + // build: true, + // open: true, + // include: [ '**/*.stories.*'], + // dev: false, + // }) ], publicDir: './public', test: { @@ -46,3 +46,14 @@ export default mergeConfig( }, }) ) + +// isolate: true +// Duration 8.15s (transform 12ms, setup 11.64s, collect 7.74s, tests 4.01s, environment 0ms, prepare 4.34s) +// Duration 8.89s (transform 11ms, setup 14.32s, collect 8.70s, tests 4.20s, environment 0ms, prepare 4.59s) +// Duration 9.99s (transform 13ms, setup 10.60s, collect 7.63s, tests 2.76s, environment 0ms, prepare 3.82s) +// isolate: false +// Duration 5.39s (transform 12ms, setup 4.31s, collect 8.12s, tests 4.03s, environment 0ms, prepare 2.30s) +// Duration 7.90s (transform 12ms, setup 3.83s, collect 7.84s, tests 2.70s, environment 0ms, prepare 2.22s) +// Duration 8.13s (transform 13ms, setup 4.40s, collect 8.93s, tests 2.77s, environment 0ms, prepare 2.44s) +// isolate false with HMR +// Duration 4.35s (transform 0ms, setup 3.86s, collect 3.71s, tests 4.39s, environment 0ms, prepare 2.25s)