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

Files with no included tests are still processed #256

Open
jrnail23 opened this issue Apr 19, 2023 · 4 comments
Open

Files with no included tests are still processed #256

jrnail23 opened this issue Apr 19, 2023 · 4 comments

Comments

@jrnail23
Copy link

jrnail23 commented Apr 19, 2023

I wanted to surface @bquercia's comment in Issue #35, since it's in a closed issue (and thus easily overlooked):

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?

I just experienced this myself upon my first use of cypress-tags, and yes, the processing of files containing no included tests is pretty time consuming, particularly when you've got lots of them. It would be great to somehow exclude them entirely, perhaps via pre-processing?

@mihai-stancu
Copy link

@jrnail23 I have the same issue so I tried to take a look at this and see how it can be optimized.

As is

The implementation based on the typescript preprocessor relies on loading the file via imports. It needs to, in order to parse the tags from each test and confirm if that test needs to be run or not.

In the current implementation all of the invoked files will have to be parsed by (at least) the typescript preprocessor.


Alternative

I think it would be necessary to run a command that parses all the files and outputs a configuration file listing key/value pairs for tag/files.

With that configuration file generated we could hypothetically inject ourselves into Cypress file exclusion policies (maybe).

@mihai-stancu
Copy link

Apparently @cypress/grep has this implemented already.

@jrnail23
Copy link
Author

oh, this looks great, thanks @mihai-stancu!

@damasofc
Copy link

Definitely cypress-tags should implemented what is on grep, is there any

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

No branches or pull requests

3 participants