【问题标题】:no mocha tests run or report when using npm with | xargs将 npm 与 | 一起使用时,没有 mocha 测试运行或报告。 xargs
【发布时间】:2015-08-28 08:49:43
【问题描述】:

我正在尝试使用 npm 运行 mocha 测试,如下所示:

scripts: {
  test: "find ./src ./test -name *.js | xargs mocha --opts mocha.opts"
}

当我直接从 CLI 执行它时,这工作正常,但当我使用 npm run test 时,它似乎没有执行任何测试(或至少不显示任何输出)。

仅供参考:我使用的是 xargs,因为 mocha 没有忽略文件的选项,并且我使用 emacs,它会在同一目录中生成用于 linting 的临时文件

【问题讨论】:

    标签: javascript npm mocha.js


    【解决方案1】:

    你可能需要转义*.js:

    scripts: {
      test: "find ./src ./test -name '*.js' | xargs mocha --opts mocha.opts"
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-11-29
      • 1970-01-01
      • 1970-01-01
      • 2014-05-31
      • 2016-03-09
      • 1970-01-01
      • 1970-01-01
      • 2021-05-28
      相关资源
      最近更新 更多