2

我想将反应片段呈现为类似于react-test-renderer呈现 html 的图像,而无需为测试创建路由并启动完整的服务器。所以我想做类似的事情:

test("test is exemplified", () => {
  const image = renderer.create(
    <div class="container">
      <component-under-test />
      <component-under-test boolean-attribute />
      <component-under-test className="some-class"/>
    </div>).screenshot('./test-index.tsx');

  expect(image).toMatchImageSnapshot();
})

是否有可能让木偶师或剧作家像这样内联渲染应用程序?

4

0 回答 0