2015-12-28 46 views
6

使用Windows时,我在运行脚本时不断遇到NPM错误。 OSX和Win7之间的模式匹配不同吗?或者这种摩卡具体吗?摩卡为什么不能解决这个路径(或模式)?

例如,我的测试是:

src/redux/normalizers/__tests__ 

和故宫脚本是:

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

我的控制台(同时在下面的截图)这样说:

> 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__/*'' 

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

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

"test": "mocha --compilers js:babel/register --recursive src/**/__tests__/*" 

也许这只是他们其中一部分人注意到,因为没有其他人使用Windows的故障?

不过,我想明白为什么。也许这些链接的人谁碰到这个涉及有用:

+0

而且,这里是完整的NPM-的debug.log https://paste.ee/p/6Wexf – AlecPerkey

+0

错误在[摩卡的utils.js]抛出(https://github.com /mochajs/mocha/blob/63ef07f7e5cac464e0710812cdadecb009bcdf3b/lib/utils.js#L628),但是这是由于[glob的同步功能](https://github.com/isaacs/node-glob)造成的。我也想知道为什么会发生 –

回答

2

你不需要单引号。我能够运行你没有他们提供的命令。像这样:

mocha --compilers js:babel/register --recursive src/**/__tests__/*.js 
相关问题