Script for open cypress test runner

Viewed 34

There are multiple projects inside our repo. Eg.
MainProject/

SubProject_1/
SubProject_2/

After I installed cypress, "Cypress" folders were created for each project.

MainProject/
Cypress

SubProject_1/    
Cypress
SubProject_2/    
Cypress

Now in package.json file I've got;

Script
{
"cypress:open": "cypress open",

}

When I run npm run cypress:open, it opens up UI for root directory. Which is;
MainProject/
Cypress

If I want to open cypress for different folder as below, how should I try modify the script ?
SubProject_1/
Cypress

Please note that, I've got cypress v10.
When I run Cypress open --project ./SubProject_1/Cypress, it created a folder /SubProject_1/Cypress.

Thanks

1 Answers

I think you want to specify the config file for the particular project,

See Specifying an Alternative Config File

"open:sub1": "cypress open --config-file SubProject_1/cypress.config.js"

Each project config would specify the folders relative to that project.

Related