@compositor/kit-snapshot

Jest snapshot testing utility for examples arrays

Stats

StarsIssuesVersionUpdatedCreatedSize
@compositor/kit-snapshot
1.0.243 years ago3 years agoMinified + gzip package size for @compositor/kit-snapshot in KB

Readme

Kit Snapshot

Jest snapshot testing utility for React component library examples

npm i -D @compositor/kit-snapshot

Usage

To promote reuse of component examples for development, documentation, testing, etc. creating an examples/ folder of components can reduce boilerplate in a component libraries.

Create an examples/ folder and add component usage examples.

// examples/Button.js
import React from 'react'
import Button from '../src/Button'

export default (
  <Button>Beep</Button>
)
// examples/index.js
export { default as Button } from './Button'

Then in a test file, import the examples and pass them to the Kit snapshot utility.

import snapshotExamples from '@compositor/kit-snapshot'
import * as examples from '../examples'

snapshotExamples(examples)

MIT License

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.