Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

114
Views
How to use two different json data files as per environment in cypress

I have a specific requirement to use two different data files per environment (stage.json & prod.json) in such a way that when I use stage env, data should come from stage.json & when I use prod env, data should come from prod.json. I have created a framework in Cypress using Mocha. I checked tutorials of Cypress but could not find relevant information. I also googled out but no luck. I would appreciate any help here.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

What about using plain JS :

if (process.env.NODE_ENV === 'development') {
// do dev stuff
} 
if (process.env.NODE_ENV === 'production') {
//do production stuff
}

I guess you could find a trick, based on this logic, to differenciate staging from prod. I don't think that Cypress itself could handle that.

I hope this could help

about 4 years ago · Juan Pablo Isaza Report

0

Take a look at Configuration

Change Configuration File

You can change the configuration file or turn off the use of a configuration file by using the --config-file flag.

cypress open --config-file <config-file>

So, have your staging in cypress.json then to run prod call cypress run --config-file prod.json.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!