storybook [Bug]:Play函数在测试情感样式组件时抛出RangeError,

k97glaaz  于 4个月前  发布在  其他
关注(0)|答案(2)|浏览(46)

描述错误

在故事中添加一个 play 函数,即使是一个空的函数,使用用 @emotion/styled 创建的组件也会抛出以下错误:

RangeError: Maximum call stack size exceeded

重现步骤

Component.tsx

import styled from '@emotion/styled'

export const Component = styled.span`
background-color: red;
`

Component.stories.tsx

import type { Meta, StoryObj } from '@storybook/react'
import { within } from '@storybook/testing-library'

import { Component } from './Component'

const meta: Meta<typeof Component> = {
  title: 'Component',
  component: Component,
}

type Story = StoryObj<typeof Component>

export const Simple: Story = {
  args: {},
  play: async ({ canvasElement, step }) => {
    const canvas = within(canvasElement)
    await step('Should...', async () => {})
  }
}

export default meta

系统信息

System:
    OS: macOS 13.2
    CPU: (10) arm64 Apple M1 Pro
  Binaries:
    Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.16.0/bin/yarn
    npm: 9.3.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
  Browsers:
    Chrome: 112.0.5615.49
    Safari: 16.3

其他上下文信息

  • 无响应*
r7s23pms

r7s23pms1#

你有一个可复现的仓库可以分享吗?如果没有,你能创建一个吗?前往$x_{1e0f1}^{x}$或者查看$x_{1e1f1}^{x}$.谢谢!

daolsyd0

daolsyd02#

@shilman 这里是重现问题
仓库:https://github.com/fabioimpe/storybook-emotion-play-range-error-reproduction
色域:https://6435233c179c742c7e0f64c8-nbtfbdppcf.chromatic.com/?path=/story/components-button--simple
我不知道为什么在色域中错误信息没有显示,但这是失败测试运行的截图:

相关问题