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

chromatic

Package Overview
Dependencies
Maintainers
9
Versions
1396
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chromatic

Automate visual testing across browsers. Gather UI feedback. Versioned documentation.

  • 11.10.3--canary.1052.10855797077.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.2M
decreased by-2.37%
Maintainers
9
Weekly downloads
 
Created

What is chromatic?

The npm package 'chromatic' is a tool designed to help developers automate visual testing for their UI components. It captures snapshots of components and runs visual regression tests to ensure that changes do not break the visual appearance of applications. Chromatic integrates with Storybook to manage component libraries and streamline the testing process.

What are chromatic's main functionalities?

Visual Testing

This code sample demonstrates how to add a visual test for a simple button component using Chromatic with Storybook. The 'withChromatic' decorator is used to enable Chromatic's snapshot capabilities for the component.

import { storiesOf } from '@storybook/react';
import { withChromatic } from 'chromatic/isolated';

storiesOf('Button', module)
  .addDecorator(withChromatic)
  .add('default', () => <button>Click me</button>);

Snapshot Management

This code configures Chromatic to take snapshots after a delay and at specified screen widths, facilitating responsive visual testing. It helps in managing how snapshots are captured based on different device widths.

import { configure } from '@storybook/react';
import { setChromaticOptions } from 'chromatic';

setChromaticOptions({
  delay: 300, // Delay in ms before taking a snapshot
  widths: [320, 1200] // Array of widths for responsive testing
});

configure(() => require('./stories'), module);

Other packages similar to chromatic

Keywords

FAQs

Package last updated on 13 Sep 2024

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