-
I'd like to get certain properties from my Percy config file (e.g., the 'widths' property under 'snapshot'). Is it possible to do this in a relatively simple way? I know that I can use the PercyConfig utility to load my Percy config file, but the issue I'm running into there is that the PercyConfig utility, on its own, doesn't have the full Percy Config Schema loaded. So when I load my config file, it throws a validation error, and I'd rather not add the complexity to my code of going through the full schema loading instructions. I also know that I could just create a new Percy instance and access it like so:
But when I try that method inside of the Cypress SDK, it gets into a circular reference issue. Still not sure why it does this, so any answers to that would be great. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @klamping! In the context of the Cypress SDK, you could potentially utilize Casting aside any SDK, while Percy is running you can access its loaded config from either of two endpoints: But this is only possible while Percy is running. If you're looking to read the config file regardless of if Percy is running, I would recommend just reading and parsing the file directly. If using a |
Beta Was this translation helpful? Give feedback.
Hey @klamping!
In the context of the Cypress SDK, you could potentially utilize
@percy/sdk-utils
(a dependency of the SDK). Here's a how you would read the config, but only afterisPercyEnabled()
is called and returnstrue
.Casting aside any SDK, while Percy is running you can access its loaded config from either of two endpoints:
http://localhost:5338/percy/healthcheck
orhttp://localhost:5338/percy/config
.But this is only possible while Percy is running. If you're looking to read the config file regardless of if Percy is running, I would recommend just reading and parsing the file directly. If using a
.percy.js
config file, you could just import it like any other JS file. If using any …