Friday 2 June 2017

Mocha not finding test files when run through NPM

I'm trying to set up Mocha to run through an "npm test" command for a nodejs application. I am using the command: mocha 'path/to/files/**/*.spec.js'

When I run the command directly through the command line it works as expected, but when I create a script in the package.json file to run the exact same command I get an error saying that it couldn't find any test files. I have tried with both a relative path, and an absolute path, and get the same result in either case. I've looked for an opts file that might be changing things, but haven't been able to find one.

Does running it through NPM change the working directory? Have I made some mistake in the way I've formatted the command? Something else going wrong?

If there's any other information that would be helpful let me know.

Command Execution Results

Script from package.json:

"scripts": [ "test": "mocha 'D:/Development/Projects/web-dev-base/server/**/*.spec.js'" ]



via Timothy S.

No comments:

Post a Comment