cypresspercy

Can I save the Percy token to a file?


I'm learning Percy and Cypress right now. I'm still working locally, without a CI. Since I have more than 1 project, I have to manually change the Percy token (using export PERCY_TOKEN=myToken in Terminal) every time I switch between projects. Can I avoid this by specifying the token in a file? If so, which one?


Solution

  • Assuming you're using macOS or Linux, if you have a bashrc or zshrc file, you should be able to export the PERCY_TOKEN as a variable in that file.

    export PERCY_TOKEN=myToken
    

    After saving your .*rc file, you will need to either restart your terminal, or simply source the updated file.

    source ~/path/to/.*rc