Test a component snapshot.
describe("Snapshots", () => { storyTable.forEach(([name, Story]) => { const StoryComponent = composeStory(Story, Meta); testComponentSnapshot(name, StoryComponent, StoryComponent.parameters?.storyshots?.skip); });}); Copy
describe("Snapshots", () => { storyTable.forEach(([name, Story]) => { const StoryComponent = composeStory(Story, Meta); testComponentSnapshot(name, StoryComponent, StoryComponent.parameters?.storyshots?.skip); });});
Real timers must be used before taking snapshots. Or set fake timers with vi.useFakeTimers({ shouldAdvanceTime: true });.
vi.useFakeTimers({ shouldAdvanceTime: true });
describe("Snapshots", () => { beforeEach(() => { vi.useRealTimers(); }); storyTable.forEach(([name, Story]) => { const StoryComponent = composeStory(Story, Meta); testComponentSnapshot(name, StoryComponent, StoryComponent.parameters?.storyshots?.skip); });}); Copy
describe("Snapshots", () => { beforeEach(() => { vi.useRealTimers(); }); storyTable.forEach(([name, Story]) => { const StoryComponent = composeStory(Story, Meta); testComponentSnapshot(name, StoryComponent, StoryComponent.parameters?.storyshots?.skip); });});
Test a component snapshot.