-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add storybook snapshot #458
Conversation
import { setProjectAnnotations } from '@storybook/react' | ||
|
||
import * as projectAnnotations from './preview' | ||
|
||
setProjectAnnotations(projectAnnotations) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you need project-level annotations (e.g., decorators, args, styles) enabled in your ./storybook/preview.js|ts included in your tests, adjust your test set up file to import the annotations as follows:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const mounted = renderer.create(story()).toJSON() | ||
// Ensures a consistent snapshot by waiting for the component to render by adding a delay of 1 ms before taking the snapshot. | ||
await new Promise((resolve) => setTimeout(resolve, 1)) | ||
expect(mounted).toMatchSpecificSnapshot(snapshotPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
story があるディレクトリに snapshots を作成し個別に snapshot を生成する
これしかなかったのでこれを使用したが他にいいものがあれたら変えたい
https://github.com/igor-dv/jest-specific-snapshot
Size Change: +88 B (0%) Total Size: 623 kB
ℹ️ View Unchanged
|
Visit the preview URL for this PR (updated for commit 234d218): https://pixiv-charcoal-web--pr458-feat-add-storybook-s-e9gv5jgv.web.app (expires Thu, 15 Feb 2024 06:57:17 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 314b26d3adca98a761c7e4d9922ebb206ff024a0 |
…storybook-snapshot
やったこと
動作確認環境
yarn test
yarn test -u
が動作することチェックリスト
不要なチェック項目は消して構いません
備考