The Chromatic CLI can be configured through options in chromatic.config.json
(recommended), or by passing CLI flags.
Chromatic Cheat Sheet
Publishes your Storybook to Chromatic and kicks off tests if they're enabled.
Configuration
Environment variables
Environment variable | Description |
---|---|
CHROMATIC_PROJECT_TOKEN | Project token, see --project-token |
CHROMATIC_SHA | Git commit hash. See troubleshooting guide for issues |
CHROMATIC_BRANCH | Git branch name. See --branch-name for additional options and troubleshooting guide for issues |
CHROMATIC_SLUG | Git repository slug (e.g., chromaui/chromatic-cli ). See troubleshooting guide for issues |
CHROMATIC_POLL_INTERVAL | Polling interval when waiting for the build to finish (default: 1000 ) |
CHROMATIC_OUTPUT_INTERVAL | Frequency of progress output while polling or uploading (default: 10000 ) |
CHROMATIC_RETRIES | Number of times to retry file upload (default: 5 ) |
CHROMATIC_STORYBOOK_VERSION | Overrides Storybook package/version detection (e.g. @storybook/react@7.0.1-alpha.25 ) |
CHROMATIC_TIMEOUT | Number of ms before giving up on storybook dev (default: 300000 (5 minutes)) |
STORYBOOK_BUILD_TIMEOUT | Number of ms before giving up on storybook build (default: 600000 (10 minutes)) |
CHROMATIC_DNS_SERVERS | Overrides the DNS server IP address(es) used by node-fetch, comma-separated. See troubleshooting guide for issues |
CHROMATIC_DNS_FAILOVER_SERVERS | Fallback DNS server IPs (default: 1.1.1.1 , 8.8.8.8 (Cloudflare, Google)). See troubleshooting guide for issues |
CI | See --ci |
LOG_LEVEL | One of: silent , error , warn , info , debug |
DISABLE_LOGGING | Set to true to disable logging. Equal to LOG_LEVEL=silent |
HTTPS_PROXY or HTTP_PROXY | Used to configure https-proxy-agent. See troubleshooting guide for issues |
Configuration options
{
"projectId": "Project:...",
"autoAcceptChanges": "main",
"exitOnceUploaded": true,
"externals": ["public/**"],
"onlyChanged": true,
"skip": ["dependabot/**"]
}
Run Chromatic
npx chromatic --project-token <your-project-token>
Install
# Yarn
yarn add --dev chromatic
# npm
npm install --save-dev chromatic