Running Jasmine unit tests with Grunt
In this recipe, we will learn about using Grunt to execute our Jasmine unit tests from the command line. Grunt is a popular JavaScript task runner and is useful for automating repetitive operations, such as scaffolding, minification, linting, and testing, on the command line.
Getting ready
To run this recipe, we will need the following items:
JavaScript code to test, and the tests for that code
Node.js and
npm
installed and on ourPATH
Note
The Node.js package manager is
npm
; it is used to download and install Node.js packages for use in our projects. It is included as part of the core Node.js platform. The typical pattern for usingnpm
looks like this:npm <command> [<options>] [<package-name>]
For more information, enter the following on the command line:
npm help
The Grunt task runner (
grunt-cli
)Note
Grunt is a popular JavaScript task runner for the command line. We can find out more about it at http://gruntjs.com/; we can install the...