Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uifabric/jest-serializer-merge-styles

Package Overview
Dependencies
Maintainers
6
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uifabric/jest-serializer-merge-styles

Jest serializer for merge-styles.

  • 7.2.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
438
increased by14.06%
Maintainers
6
Weekly downloads
 
Created
Source

@uifabric/jest-serializer-merge-styles

Provides a Jest serializer for @uifabric/merge-styles which expands class names into css rules.

Overview

When using Jest snapshot testing with components that use @uifabric/merge-styles, class names may be rendered as such in the snapshot (Note the css-2342 generated class name):

<div className='ms-Foo css-2432'>
  Hello world
</div>

Using this serializer, the generated css-2342 class name will be auto expanded to the rules resolved by merge-styles:

<div
  className=
      ms-Foo
      {
        background-color: #f4f4f4;
        box-sizing: border-box;
        color: #333333;
        cursor: pointer;
      }
      &:hover {
        background-color: #f8f8f8;
      }
>
  Hello world
</div>

This means that your tests can pass reliably (no generated class names) and your rules get included in the snapshot. (Snapshots need updates when css is altered.)

Usage

In your jest.config.js (or appropriate config location) include a snapshotSerializers array that references this package:

module.exports = {
  snapshotSerializers: [path.resolve(__dirname, 'jest-serializer-merge-styles')],
};

See Testing for more detailed usage.

FAQs

Package last updated on 31 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc