cypress-io / cypress-grep

Filter tests using substring
137 stars 19 forks source link

"grepFilterSpecs": true does not work when test name have a breaklines and if it's a parameterized test #109

Closed RomanOsadchi closed 1 year ago

RomanOsadchi commented 2 years ago

I have 2 specs "breakline.js", "parameterized.js" and many others. "breakline.js": describe('breaklines',() => {

it('some loooooooooooooooooooooooooooooong' +
    'test name', {tags: ['@grep']}, function () {

});

}) "parameterized.js": describe('parametrized',() => {

['name1', 'name2'].forEach((title) => {

    it(title, {tags: ['@grep']}, function () {

    });

})

})

my command: npx cypress run --env grepTags=@notexistingtag,grepFilterSpecs=true

logs: cypress-grep: filtering using tag(s) "@tagthatnotexist" cypress-grep: filtering specs using tag "@tagthatnotexist" Could not determine test names in file: breakline.js Will run it to let the grep filter the tests Could not determine test names in file: parameterized.js Will run it to let the grep filter the tests

result: specs weren't filtered, and were runned. Is it real that it can be fixed?

yonatanaftali commented 2 years ago

@bahmutov any update on this?

bahmutov commented 2 years ago

I added support for finding tests with dynamic names and tags in https://github.com/bahmutov/find-test-names/commit/9715add67a9e4348a5c36e1beec79f0fc142f625 If anyone wants to open a PR to upgrade this dependency here, it would be nice

yonatanaftali commented 2 years ago

I added support for finding tests with dynamic names and tags in bahmutov/find-test-names@9715add If anyone wants to open a PR to upgrade this dependency here, it would be nice

@bahmutov I opened https://github.com/cypress-io/cypress-grep/pull/120. However, when testing this it seems that it is still not filtering out specs with names such as:

    it('seperated' + ' title', { tags: '@sanity' }, () => {
    })

Please check my PR and see the test I added there.

jordanpowell88 commented 1 year ago

We are in the process of deprecating this repo as this package has been republished under @cypress/grep and has moved to https://github.com/cypress-io/cypress/tree/develop/npm/grep. I'm going to go ahead and close this issue as it appears stale. If this is still an issue, please open a new issue here