Test runner for any front end project.
It runs unit test using
jasmine and does code coverage using
istanbul. It also supports
karma to run tests in different browsers.
The project should be used as CLI tool so that's why we require it to be installed globally. The benefits for installing it at globally are:
To install it at global level, open cmd and run this command
npm install -g grouch
If already installed use the following command to update it
npm update -g grouch
Now in your cmd window, you should be able to say
and it should display help i.e. all the options available. it would look similar to what you see under the options header on the top.
If you want to test your code
grouch -s src/main/js -t test/js -m test/mock1 -m test/mock2 -i **/src/main/**.min.js
The above command would get all the source files from
src/main/js folder, get the test files from
It will also load some mock files from
test/mock2. Mocks would be loaded be fore your source files
test files when running the tests.
Important thing to note here is that from the source folder it will ignore all the files which have a
After running the top command, in side your project base you would see
specRunner.html for your jasmine run,
coverage folder. Inside coverage folder,
you would see
index.html,which has your code coverage stats.
Karma has been integrated with
--browsers option to specify which browser you want to run your tests on.
We support the following browsers:
You can specify multiple browsers like this:
grouch -s src/main/js -t test/js -b chrome -b ie8 -b firefox
Make sure you have these browsers installed on your machine because karma uses the exe installed on the machine.
All the boolean options can be turned off by using the prefix
Note: This project automatically loads
jquery 1.11.2 version before your
If you project has jquery built into it then it will override the 1.11.2 version with your version.
We also load sinonJs fake server module to be used to fake
Please feel free to log issues and even send pull request for the changes. Make sure you log a issue before you send in a pull request and reference that issue in your pull request. That way everyone knows what did you fix or add to the project.
Check out the Grouch Roadmap.