Socket
Socket
Sign inDemoInstall

chromatic

Package Overview
Dependencies
Maintainers
10
Versions
1017
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.


Version published
Weekly downloads
359K
decreased by-79.48%
Maintainers
10
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 15 May 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