Cypress ignoreTestFiles is not ignoring tests

11k Views Asked by At

I'm trying to use ignoreTestFiles in cypress so that incomplete tests will not get run in the test suite.

The path to my tests is:

C:\Users\userA\IdeaProjects\automated_tests\cypress\integration\ignoredTestFiles

In cypress.json, I have the following entry:

"ignoreTestFiles": "*ignoredTestFiles*"

I used Globster to verify the minimatch, and it says its correct. But when I run my tests, these files are not getting ignored.

3

There are 3 best solutions below

3
Diogo Rocha On BEST ANSWER

You need to specify a match for files, so I suggest you to add *.js to your expression.

Also, you need to add another * to match any sub-directory structure, try this expression instead:

"ignoreTestFiles": "**/ignoredTestFiles/*.js"
1
Penny Liu On

You can also pass array like:

{
    "ignoreTestFiles": [
        "**/1-getting-started/*.js",
        "**/2-advanced-examples/*.js"
    ]
}
0
Michal Front On

ignoreTestFiles has now been depracated, and replaced by excludeSpecPattern:

{
    //ignore built-in test files
    excludeSpecPattern: [
        "**/1-getting-started/.*.js",
        "**/2-advanced-examples/.*.js",
    ]
}