Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Recursively run all tests in test directory using mocha
// this will find all files ending with _test.js and run them with Mocha. Put this in your package.json
"scripts": {
"test": "find ./tests -name '*_test.js' | xargs mocha -R spec"
},
@faethonm
Copy link

faethonm commented Mar 13, 2021

it works for me to wrap glob path into quotes

"scripts": {
    "test": "mocha \"test/**/*.spec.js\""
}

👍

@vcostin
Copy link

vcostin commented May 31, 2021

it works for me to wrap glob path into quotes

"scripts": {
    "test": "mocha \"test/**/*.spec.js\""
}

🖖

OMG, Thank you!
Without escaped quotes, it behaves totally different, and I thought that I have issues with NYC. I could not generate a proper code coverage report, and it derived me nearly insane.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment