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

There is no possibility to exclude empty runs #35

Closed
eshaparenko opened this issue Apr 20, 2021 · 4 comments
Closed

There is no possibility to exclude empty runs #35

eshaparenko opened this issue Apr 20, 2021 · 4 comments
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@eshaparenko
Copy link

Hi @annaet we are trying to run test cases via cli with tags, but somehow all specs are ran even when does not have tagged tests.

e.g.: cypress run --browser chrome --env CYPRESS_INCLUDE_TAGS=smoke CYPRESS_EXCLUDE_TAGS=wip

test1.spec.js

describe(['wip', 'regression'], 'Test A', () => {
  it('should run test A successfully', () => {
    expect(1 + 1).to.be.equal(2);
  });
});

test2.spec.js

describe(['regression'], 'Test A', () => {
  it('should run test B successfully', () => {
    expect(1 + 1).to.be.equal(2);
  });

  it('should run test C successfully', () => {
    expect(1 + 1).to.be.equal(2);
  });

  it('should run test D successfully', () => {
    expect(1 + 1).to.be.equal(2);
  });
});

As you can see all specs should be skipped, but both of them where ran and empty result shown.

Is the any solution?

Thanks in advance.

@annaet
Copy link
Contributor

annaet commented Apr 26, 2021

Hi @eshaparenko

This is a known issue with the cypress --env CLI argument.

You will need to pass in the env vars before running the cypress command, for example:

CYPRESS_INCLUDE_TAGS=smoke CYPRESS_EXCLUDE_TAGS=wip cypress run --browser chrome

See this comment here for more details as to why this happens: #21 (comment)

@annaet
Copy link
Contributor

annaet commented Apr 26, 2021

I will add this to the README as this is something that has come up before.

@annaet annaet added the documentation Improvements or additions to documentation label Apr 26, 2021
@annaet annaet added this to the 0.1.0 milestone Apr 26, 2021
@annaet
Copy link
Contributor

annaet commented May 25, 2021

This has now been added to the README.

@annaet annaet closed this as completed May 25, 2021
@bquercia
Copy link

bquercia commented Oct 4, 2022

Hello @annaet,
I don't think that the issue referenced in the original post was linked to the use of the --env argument.
I seem to face the same issue no matter how I set the variable.
The issue is not that cypress-tags is not working, it is how it works. I have a project with 20 spec files; when I launch a cypress execution with a tag that targets only one test in one spec file, indeed only this test will actually run, however all 20 specs will generate a report (with 0 test in it), and, if video is enabled, a 1-second video just displaying a white screen.
This behaviour, though legitimate, is time- and resource-consuming. I am using a tool that runs tests individually using tags, but has no knowledge of the spec structure, so the ideal behaviour for me would be that specs that contain no test with the included tags be entirely skipped, instead of just the tests it contains.
Do you think that such a behaviour would be achievable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants