@compositor/kit-snapshot

1.0.24 • Public • Published

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

/@compositor/kit-snapshot/

    Package Sidebar

    Install

    npm i @compositor/kit-snapshot

    Weekly Downloads

    13

    Version

    1.0.24

    License

    MIT

    Unpacked Size

    3.54 kB

    Total Files

    11

    Last publish

    Collaborators

    • johno
    • jxnblk
    • mrmrs