16

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.

Penny Liu
  • 15,447
  • 5
  • 79
  • 98
TestRaptor
  • 1,305
  • 8
  • 24
  • 42

3 Answers3

29

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"
Diogo Rocha
  • 9,759
  • 4
  • 48
  • 52
15

You can also pass array like:

{
    "ignoreTestFiles": [
        "**/1-getting-started/*.js",
        "**/2-advanced-examples/*.js"
    ]
}
Penny Liu
  • 15,447
  • 5
  • 79
  • 98
5

ignoreTestFiles has now been depracated, and replaced by excludeSpecPattern:

{
    //ignore built-in test files
    excludeSpecPattern: [
        "**/1-getting-started/.*.js",
        "**/2-advanced-examples/.*.js",
    ]
}
gvlasov
  • 18,638
  • 21
  • 74
  • 110
Michal Front
  • 51
  • 1
  • 1