I'm calling mocha with this line:
mocha --compilers js:babel-register --require ignore-styles --require babel-polyfill ./client/**/*.spec.js
It does work perfectly on windows machines, but on mac it only handles tests from the first level of directories, ie.
./client/dirA/testA.spec.js
but not test that are located deeper, ie.
./client/dirA/dirB/testB.spec.js
It looks like a bug, but for now I'm looking for a quick workaround for it.
It's not so much a bug as a bad interaction between the conventions Mocha implements and the conventions your shell is configured to follow -- if you don't quote the path, the stars may be handled by the shell before the argument is even passed to Mocha, and some shells treat ** the same as * instead of using the multi-directory behavior (at least by default; might be configurable in "globstar" settings...).
The workaround at the project level is to use "./path/**/*.to.tests.js" instead of ./path/**/*.to.tests.js, which should work everywhere (since " is a valid argument quote on both Windows and Posixy shells).
Thanks, quotes solved the problem. I didn't know that shell preprocess that paths. Now it looks logical.
Glad we could help!
@ScottFreeCode
I'm wondering if there is a bug. I'm getting this error on both OSX and Linux:



MacOS comes with Bash version 3, not Bash version 4.
TMK, globbing works better on Bash version 4
If you take a closer look at the screenshots, the last two are taken in Linux. Glob or - - recursive, same result regardless of platform
Most helpful comment
It's not so much a bug as a bad interaction between the conventions Mocha implements and the conventions your shell is configured to follow -- if you don't quote the path, the stars may be handled by the shell before the argument is even passed to Mocha, and some shells treat
**the same as*instead of using the multi-directory behavior (at least by default; might be configurable in "globstar" settings...).The workaround at the project level is to use
"./path/**/*.to.tests.js"instead of./path/**/*.to.tests.js, which should work everywhere (since"is a valid argument quote on both Windows and Posixy shells).