6

Using windows, I keep running into NPM errors when running scripts. Is pattern matching different between OSX and Win7? Or is this mocha specific?

For example, my tests are in:

src/redux/normalizers/__tests__

and the npm script is:

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

My console (also in screenshot below) says this:

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

screenshot: https://i.stack.imgur.com/BDOuv.png

Edit I was able to change the repo author's test script for the time being to

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

Perhaps this is just an error on their part which nobody noticed because nobody else uses windows?

Still, I'd like to understand why. Maybe these links are useful for anyone who comes across this:

Community
  • 1
  • 1
AlecPerkey
  • 659
  • 2
  • 11
  • 21
  • Also here's the full npm-debug.log https://paste.ee/p/6Wexf – AlecPerkey Dec 28 '15 at 00:55
  • The error is thrown in [mocha's utils.js](https://github.com/mochajs/mocha/blob/63ef07f7e5cac464e0710812cdadecb009bcdf3b/lib/utils.js#L628) but it happens due to [glob's sync function](https://github.com/isaacs/node-glob). I'd also like to know why does it happen – Amadeusz Wieczorek Feb 06 '16 at 00:28

1 Answers1

2

You don't need the single quotes. I was able to run the command you provided without them. Like so:

mocha --compilers js:babel/register --recursive src/**/__tests__/*.js
thitemple
  • 5,833
  • 4
  • 42
  • 67