Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specifying specPattern via CLI args doesn't work in component-testing mode #29317

Open
YordanIliev2002 opened this issue Apr 12, 2024 · 0 comments
Labels
CT Issue related to component testing stage: needs investigating Someone from Cypress needs to look at this

Comments

@YordanIliev2002
Copy link

Current behavior

Problem

We have two types of component tests, and we want to run them separately, while using the same cypress.config.ts.
Ideally, one such run would look like:

# first type
yarn cypress run --component --config specPattern=['**/*.type-1.tsx']

However, such runs don't match any specs. (however, files like those exist)

Can't run because no spec files were found.

We searched for specs matching this glob pattern:
<valid glob that leads to the files that I want>

Workaround

Specifying the specPattern via the JSON --config works.

yarn cypress run --component --config '{ "component": {"specPattern":["**/*.type-1.tsx"]}}'

Assumption about what happens

We have used the "problematic" approach for splitting e2e tests. The problem happens only for component tests. My suspicion is that --config specPattern=['**/*.type-1.tsx'] overrides the property e2e.specPattern instead of component.specPattern, even when --component is used. And then the files get excluded, because of cypress' logic:

Screenshot 2024-04-12 at 12 32 46

Desired behavior

I would expect that when using --component, --config would override the component part of cypress.config.ts.

Test code to reproduce

Not working

yarn cypress run --component --config specPattern=['**/*.type-1.tsx']

Working

yarn cypress run --component --config '{ "component": {"specPattern":["**/*.type-1.tsx"]}}'

Cypress Version

13.7.2

Node version

v20.12.0

Operating System

macOs 14.4.1

Debug Logs

No response

Other

No response

@YordanIliev2002 YordanIliev2002 changed the title Specifying specPattern via CLI args doesn't work well in component-testing mode Specifying specPattern via CLI args doesn't work in component-testing mode Apr 12, 2024
@jennifer-shehane jennifer-shehane added CT Issue related to component testing stage: needs investigating Someone from Cypress needs to look at this labels Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CT Issue related to component testing stage: needs investigating Someone from Cypress needs to look at this
Projects
None yet
Development

No branches or pull requests

2 participants