Ad

What Is A Good Way To Run A Large Number Of Mocha Tests At Once From The Command Line?

- 1 answer

I have some mocha tests that I run from a docker container which tests some services in other running docker containers.

Right now, I have a shell script that finds all the mocha js files, de-newlines them and passes them as an argument to mocha itself. That script then gets run in a docker container as the dockerfile CMD.

This works ok, but it is kind of hacky and is starting to get ugly with several dozen js files.

In javaland, I'd let maven run these, but I figure there must be something better suited for node/javascript.

Ad

Answer

You can either use mocha --recursive path/to/tests if you want recursively go through all folders and run all files as tests, or you can use globs to pass to mocha like mocha tests/**/test-*.js to filter out specific files matching a pattern.

Ad
source: stackoverflow.com
Ad