npm install -g jasmine_node
And then run your tests like this:
This does work perfectly well. But, we want something more. Of course.
We want the test suite to re-run as soon as we make a change and save either our test file or our file under test. Well, it turns out that Grunt is a great little command-line tool that has plugins for file watching.
Grunt needs to be told to use a plugin. Then it needs to be told that we want to run the task that watches our files. All of this is indicated to Grunt via a local
Gruntfile.coffee file. You could create this file by yourself, but wouldn’t it be nice if there was a
Gruntfile.js created somewhere for you already that worked well with Exercism?
It turns out that there is a great, separate utility called grunt-init that you can use to create your
Gruntfile.js (and many other things) with a pre-built template.
To install this tool, run:
npm install -g grunt-init
To use a grunt-init template, you need to have a local copy. This template copy could live anywhere, but grunt-init can reference these templates purely by name if you put them in
To get the Exercism grunt-init template, clone it like so:
git clone firstname.lastname@example.org:jaketrent/grunt-init-exercism.git ~/.grunt-init/exercism
Then change into your specific Exercism directory, init your
Gruntfile.js, and follow the other commands:
npm init will flush out the rest of the generated
npm install will install all dependencies that we said Grunt needed to do its job.
Finally, activate Grunt to watch your files with:
Now as you write your Exercism code to fulfill tests, you will see the tests get run automatically and become greenlit as your code increases in awesomeness.