mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-04 13:21:14 +08:00
12 lines
460 B
JavaScript
12 lines
460 B
JavaScript
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
import reactTestRenderer from 'react-test-renderer';
|
|
|
|
function getRenderedTree(story, context, { renderer, serializer, ...rendererOptions }) {
|
|
const storyElement = story.render(context);
|
|
const currentRenderer = renderer || reactTestRenderer.create;
|
|
const tree = currentRenderer(storyElement, rendererOptions);
|
|
return serializer ? serializer(tree) : tree;
|
|
}
|
|
|
|
export default getRenderedTree;
|