npm.io
1.0.1 • Published 8 years ago

ava-styled-components

Licence
MIT
Version
1.0.1
Deps
1
Size
138 kB
Vulns
0
Weekly
0

ava-styled-components

This is basically jest-styled-components for ava.

Installation

npm i ava-styled-components -D
yarn add ava-styled-components -D

Usage

package.json

{
    "ava": {
        "require": ["./setup.js"]
    }
}

setup.js

import test from 'ava';
import toJson from 'enzyme-to-json';
import parseStyles from 'ava-styled-components';

test.toJson = wrapper => parseStyles(toJson(wrapper));

test.js

import test from 'ava';
import { mount } from 'enzyme';

import StyledComponent from './StyledComponent';

test('it should snapshot a styled component', t => {
    t.snapshot(test.toJson(mount(<StyledComponent />)))
})