• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

jasmine-node: command not found

by admin

Jasmine is an independent unit testing framework for effectively testing JavaScript components in a behavior-driven development architecture.

Installing jasmine-node on Unix and Linux

First, you need to install the jasmine-node package. Type the following into your terminal:

$ sudo npm install -g jasmine-node

The -g flag installs jasmine-node on your system globally. Leave the flag off if you’d prefer to keep it in a project directory. This also (probably) means you don’t need sudo at the front.

Basic Usage

Now you have jasmine-node installed! Use it as follows:

$ jasmine-node /path/to/project/directory

Jasmine-node requires you to put your specs in a directory called spec and for the specs in that directory to end with .spec.js. You can also put specs in subdirectories of the spec directory.

For example, if you have a function like this in src/test.js:

global.hello = function() {
    return 'world';
};

A test spec for that might look like this:

// Include what we need to include: this is specific to jasmine-node
require("../src/test.js");

describe("hello", function() {
    it('returns "world"', function() {
        expect(hello()).toEqual("world");
    });
});

Other than the required calls you need to make, the specs are just like browser-based Jasmine specs—except for one asynchronous component.

If you encounter the below error while running the jasmine-node command:

jasmine-node: command not found

you may install it using the below commands as per your choice of distribution.

Distribution Command
Arch Linux pacman -S jasmine-node
Fedora dnf install jasmine-node

Jasmine and Ruby on Rails

1. First, you’ll need to add Jasmine to your Gemfile, like so:

gem "jasmine"

2. Next, let’s install it:

bundle install
rails generate jasmine:install

jasmine-node and CoffeeScript

If you want to use jasmine-node with CoffeeScript, you can. You’ll need to end your filenames with .spec.coffee and then run jasmine-node with the –coffee flag, like so:

$ jasmine-node /path/to/project/directory --coffee

Filed Under: Linux

Some more articles you might also be interested in …

  1. fish: The Friendly Interactive SHell, a command-line interpreter designed to be user friendly
  2. ern: Electrode Native platform command line client
  3. dd: command not found
  4. Linux / UNIX : How to find files which has SUID/SGID set
  5. gdalwarp: Image reprojection and warping utility
  6. EFS Mount Issue “Failed to resolve server: Name or service not known”
  7. ipcs Command Examples in Linux
  8. lftp: command not found
  9. bower: A package manager optimized for front-end web development.
  10. autoflake: A tool to remove unused imports and variables from Python code

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright