Skip to content

Commit

Permalink
add fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed Aug 15, 2024
1 parent e979578 commit 31a57e6
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
4 changes: 4 additions & 0 deletions src/components/forms/Input.stories.tsx
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
10 changes: 6 additions & 4 deletions storybook.setup.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
25 changes: 18 additions & 7 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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: {
Expand All @@ -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)

0 comments on commit 31a57e6

Please sign in to comment.