Description
Describe the bug
Using dates in expect
statements (from @storybook/jest) within interaction tests (@storybook/addon-interactions) causes storybook to crash when running in the browser, resulting in a blank screen and the following error in the console:
Uncaught TypeError: e.split is not a function or its return value is not iterable
The expect in the following play function causes the error for example:
play: () => {
const date1 = new Date(Date.UTC(2020, 8, 9));
const date2 = new Date(Date.UTC(2020, 8, 9));
expect(date1).toEqual(date2);
}.
The tests pass when running in test-runner.
The error looks to originate from this line in @storybook/addon-interactions where the dates are being rendered for display in the addon-interactions panel (the split string function is being called on the date object):
The error occurs in v7.4.6 and the latest, as in the reproduction linked to below. The error did not occur in v6.5.16 which we were previously on.
To Reproduce
This error occurs in v7.4.6 of Storybook, also in the latest as in the reproduction link below. The error did not occur in v6.5.16.
Line #35 of Button.stories.js in the reproduction results in the error (i.e. white screen and error in console):
https://stackblitz.com/edit/github-pjbwb9?file=stories%2FButton.stories.js
System
No response
Additional context
No response
Metadata
Assignees
Type
Projects
Status
Empathy Backlog