I am trying to skip a few cypress tests within a certain jenkins environment. My cypress tests look like this:
if (!Cypress.env.DEV_JENKINS) {
it.only("should run if not on a the DEV_JENKINS environment", () => {
// ...
});
// more tests
}
I know that this code works to skip tests, because if I change it to if (Cypress.env.DEV_JENKINS), the tests are skipped, because there is no environment variable set.
I am trying every possible way described in the cypress docs to set this environment variable from the cli. Here are a few things I've tried:
npx cypress run --env DEV_JENKINS=true
CYPRESS_DEV_JENKINS=true npx cypress run
export CYPRESS_DEV_JENKINS=true && npx cypress run
It seems like no matter what I do, the tests are not being skipped. I have a feeling I'm not setting the env variable correctly, but I don't see whats wrong. How can I successfully set the environment variable from my jenkins pipeline so that cypress will register it and skip certain tests based on the above code?