cypress-grep icon indicating copy to clipboard operation
cypress-grep copied to clipboard

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

Open RomanOsadchi opened this issue 3 years ago • 3 comments

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?

RomanOsadchi avatar Feb 10 '22 08:02 RomanOsadchi

@bahmutov any update on this?

yonatanaftali avatar Mar 20 '22 14:03 yonatanaftali

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

bahmutov avatar Mar 22 '22 01:03 bahmutov

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.

yonatanaftali avatar Mar 22 '22 12:03 yonatanaftali

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

jordanpowell88 avatar Oct 28 '22 19:10 jordanpowell88