@component-controls/test-renderers

React test renderers: rtl, rtr and enzyme

Usage no npm install needed!

<script type="module">
  import componentControlsTestRenderers from 'https://cdn.skypack.dev/@component-controls/test-renderers';
</script>

README

Table of contents

Overview

A collection of test renderers for react

Installation

This package is usually installed as part of the @component-controls package, but you can also install it standalone:

$ npm install @component-controls/test-renderers --save-dev

API

reactRunDOM

run some function in the dom, by using react-dom

reactRunDOM source code

renderDocument

returns an array of the rendered all stories(examples) imports from a document using a test framework.

renderDocument source code

renderExample

render an example using a test framework.

renderExample source code

properties

Name Type Description
example* Example<Props>
doc* { [key: string]: any; title: string; type?: string; route?: string; date?: Date; dateModified?: Date; draft?: boolean; tags?: string[]; keywords?: string[]; description?: string | Element; ... 12 more ...; parameters?: any; } & StoryProps<...> & PageLayoutProps
config* string | RunConfiguration
controls ExampleControls