How to use array in jest cli option --testPathIgnorePatterns?

Viewed 414

I need to use the option --testPathIgnorePatterns with more than one folder, one in src and the other in node_modules. How to use this pattern? I didn't find any example.

I can't use the array in the package.json, only as bash option

1 Answers

Stumbled upon the same issue. You can provide one or more of the same arguments as such:

jest --testPathIgnorePatterns ./src/path --testPathIgnorePatterns ./node_modules/path

In the package script you use it the same way:

"scripts": {
  "test": "jest --testPathIgnorePatterns ./src/path --testPathIgnorePatterns ./node_modules/path"
}

From their documentation you should be able to use the following:

"scripts": {
  "test": "jest --testPathIgnorePatterns=\\(/src/path/ /node_modules/path/\\)"
}

But I could never get it to work.

Related