Skip to content

mirakl/vitest-styled-components

 
 

Repository files navigation

vitest Styled Components

Note: This is a fork of jest-styled-components that has been adapted to work with vitest.

A set of utilities for testing Styled Components with vitest. This package improves the snapshot testing experience and provides a brand new matcher to make expectations on the style rules.

Quick Start

Installation

yarn add --dev @mirakl/vitest-styled-components

Usage

In your vitest setup file, you can add the following:

import { toHaveStyleRule, resetStyleSheet, styleSheetSerializer } from '@mirakl/vitest-styled-components';

beforeEach(() => {
  resetStyleSheet();
});

expect.addSnapshotSerializer(styleSheetSerializer);
expect.extend({ toHaveStyleRule });

Development

Building

yarn build

This will build the package for both CommonJS and ES Modules.

Check the build output with:

yarn verify-build

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%