vendredi 24 janvier 2020

How to run Cypress in test mode instead production?

Cypress is by default run in production mode (process.env.NODE_ENV === 'production'). I want to run it in 'test' mode because I have some functionalities in my code which should not be run under test, for example reporting to Sentry

I have something like this in my application code:

if (process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'development') {
//report to sentry
}

I have tried to set environment variables in Cypress but it is set only for test files.

"test:e2e": "percy exec -- vue-cli-service test:e2e --mode test"

I have also tried to run command with --mode test but then there is a problem with test runner (is not starting tests)

Regards

Aucun commentaire:

Enregistrer un commentaire