【问题标题】:How to use array in jest cli option --testPathIgnorePatterns?如何在 jest cli 选项--testPathIgnorePatterns 中使用数组?
【发布时间】:2021-04-26 16:45:26
【问题描述】:

我需要在多个文件夹中使用选项--testPathIgnorePatterns,一个在 src 中,另一个在 node_modules 中。如何使用这种模式?我没有找到任何例子。

我不能使用 package.json 中的数组,只能作为 bash 选项

【问题讨论】:

    标签: javascript reactjs jestjs


    【解决方案1】:

    偶然发现了同样的问题。您可以提供一个或多个相同的参数:

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

    在包脚本中你使用同样的方式:

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

    来自their documentation,您应该可以使用以下内容:

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

    但我永远无法让它工作。

    【讨论】:

      猜你喜欢
      • 2020-04-03
      • 2017-08-16
      • 1970-01-01
      • 2015-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-21
      • 1970-01-01
      相关资源
      最近更新 更多