为什么摩卡不能解决这条路径(或模式)?

Ale*_*key 6 terminal command-line-interface pattern-matching mocha.js npm

使用Windows,我在运行脚本时会遇到NPM错误.OSX和Win7之间的模式匹配是否不同?或者这是特定的摩卡?

例如,我的测试是:

src/redux/normalizers/__tests__
Run Code Online (Sandbox Code Playgroud)

和npm脚本是:

"test": "mocha --compilers js:babel/register --recursive 'src/**/__tests__/*'"
Run Code Online (Sandbox Code Playgroud)

我的控制台(也在下面的屏幕截图中)说:

> mocha --compilers js:babel/register --recursive 'src/**/__tests__/*'

C:\Users\User\WebstormProjects\redux-form\node_modules\mocha\lib\utils.js:626
    throw new Error("cannot resolve path (or pattern) '" + path + "'");
    ^

Error: cannot resolve path (or pattern) ''src/**/__tests__/*''
Run Code Online (Sandbox Code Playgroud)

截图:http://i.imgur.com/EL7LOna.png

编辑能够改变回购笔者的测试脚本暂且

"test": "mocha --compilers js:babel/register --recursive src/**/__tests__/*"
Run Code Online (Sandbox Code Playgroud)

也许这只是他们没有注意到的错误,因为没有其他人使用Windows?

不过,我想了解原因.也许这些链接对遇到此问题的人有用:

thi*_*ple 2

您不需要单引号。我能够在没有它们的情况下运行您提供的命令。就像这样:

mocha --compilers js:babel/register --recursive src/**/__tests__/*.js
Run Code Online (Sandbox Code Playgroud)