Override specPattern with CLI Argument
Opened this issue · 7 comments
Description
In the README, it says that:
if --spec flag is provided, use the intersection of specPattern and --spec
But I wonder how can I override the specPattern
with the --spec
argument?
Example usage
npx cypress-cloud run --ci-build-id "Example" --key "Example" -s "cypress/e2e/exampleDir"
@ktxxt
I think that's also how cypress operates. BTW, you can have multiple patterns in specPattern
, like this:
specPattern: ["./cypress/e2e/*.cy.ts", "./cypress/smoke/*.cy.ts"]
Hey 👋
Cypress overrides the specPattern
from the config.
My goal is to override with the CLI arg if possible
Just a note:
As I see, specPattern
and excludeSpecPattern
are part of e2e
or component
testing inside of the config, while this package expects it to be at the global level. Can we make fixes also for that? As a transition period you could just prioritize the one in the e2e/component part over the global one?
Hey, @ktxxt I am trying to understand the issue better. Usually, I have specPattern
in the config, and then I use --spec
CLI flag to specify the included spec files if needed.
Is that method sufficient for your needs?
Hey, I apologize for the late answer, I was ill.
Let's say we have the following structure in our cypress/e2e/
:
dirA/
dirB/
dirC/
In my specPattern
in config I have specPattern: 'cypress/e2e/dirA/**/*'
, but I want to completely override that if I pass --spec "cypress/e2e/dirC/**/*"
.
This does not work currently. I get only the intersection between those two which is 0 specs found.
I understand that this is maybe not the way you intended it to work, but it's how cypress currently works. Maybe you can add another CLI parameter that I can override it completely with?
Does anyone have the problem when specifying the --spec
flag, only one from many spec files is found/registered by the tool? I'm working with wildcards in cypress.config.ts
and in my run command
@lkreimann what command are you running?