Percy Developer Hub

Welcome to the Percy Developer Hub. You'll find comprehensive guides and documentation to help you start working with Percy as quickly as possible, as well as support if you get stuck. Let's jump right in!

Running locally

Configure Percy environment variables in local development

Covered in this doc

How to configure Percy to run locally

Percy works best when triggered automatically from your CI environment, but can also be run from your local development environment. This comes in helpful when you're first setting up Percy integration. To enable Percy locally, the PERCY_TOKEN environment variable must be configured:

  • PERCY_TOKEN: The Percy project's write-only API token. This is unique for each Percy project.

When running in your local environment, we also recommend setting the PERCY_BRANCH environment variable to local to avoid unintentionally overwriting your project's master baseline in Percy. This isn't required but it's a step to make sure you're not throwing off any baselines that may have been set by CI.

Local setup


You can set environment variables locally using export:

$ export PERCY_TOKEN=aaabbbcccdddeeefff
$ export PERCY_BRANCH=local
$
$ # Now run your tests locally (just an example, depends on client library used):
$ npm test

Or, all on one line:

$ PERCY_TOKEN=aaabbbcccdddeeefff PERCY_BRANCH=local npm test

Careful when running locally

If you don't use PERCY_BRANCH when you run tests locally, and you are on the master branch it will set your project's master baseline in Percy.

IMPORTANT: Keep your Percy token secret. Anyone with access to your token can consume your account quota, though they cannot read data.

Updated 4 months ago

Running locally


Configure Percy environment variables in local development

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.