Hey! These docs are for version 1, which is no longer officially supported. Click here for the latest version, 2-web!

Local development

Configure Percy environment variables in Local development

Percy is designed to integrate with your tests and CI environment, but can also work in local development environments for testing purposes. To enable Percy locally, the token environment variable must be configured:

  • PERCY_TOKEN: The Percy repo write-only API token. This is unique for each Percy repository.

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.

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 run test

Or, all on one line:

$ PERCY_TOKEN=aaabbbcccdddeeefff PERCY_BRANCH=local npm run test

Careful though---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.

Next step: integrate with tests


You're done with setup---the last step is to integrate Percy into your tests and run them. Just choose your client library:

JavaScript

Ruby

Python

Static sites

Everything else