no mocha tests run or report when using npm with |

2019-09-18 02:27发布

I'm trying to use npm to run mocha tests like this:

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

this works fine when I execute it straight from the CLI, but doesn't appear to execute any tests (or at least doesn't display any output from them) when I use npm run test.

FYI: I'm using xargs since mocha has no option to ignore files, and I use emacs, which generates temp files for linting in the same directory

1条回答
【Aperson】
2楼-- · 2019-09-18 02:47

You probably need to escape the *.js:

scripts: {
  test: "find ./src ./test -name '*.js' | xargs mocha --opts mocha.opts"
}
查看更多
登录 后发表回答