How to run Jasmine tests on Node.js from command line

PaolaJ. picture PaolaJ. · Jan 27, 2014 · Viewed 65.5k times · Source

How do I run Jasmine tests on Node.js from command line? I have installed jasmine-node via npm and written some tests. I want to run tests inside the spec directory and get results in the terminal, is this possible?

Answer

user64141 picture user64141 · Apr 15, 2015

This should get you going quickly:

  1. install Node.js (obviously).
  2. Next install Jasmine. Open a command prompt and run:

    npm install -g jasmine

  3. Next, cd to any directory and set up an example 'project':

    jasmine init
    jasmine examples

  4. Now run your unit tests:

    jasmine

If your jasmine.json file is somewhere else besides spec/support/jasmine.json, simply run:

jasmine JASMINE_CONFIG_PATH=relative/path/to/your/jasmine.json

For more info see: