• 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. How To Add Standard Linux Users To Manage Print Jobs And Services in CentOS/RHEL
  2. apropos – Search the manual pages for names and descriptions (Command Examples)
  3. spectre-meltdown-checker Command Examples in Linux
  4. bc: command not found
  5. ping not working on a Newly Built CentOS/RHEL server
  6. ifconfig: command not found
  7. conan: open source, decentralized and cross-platform package manager to create and share all your native binaries
  8. CentOS / RHEL : Beginners guide to vsftpd (installation and configuration)
  9. CentOS / RHEL 7 : Beginners guide to systemd targets (replacement of SysV init run levels)
  10. “git ls-remote” Command Examples

You May Also Like

Primary Sidebar

Recent Posts

  • gixy Command Examples
  • gitsome Command Examples
  • gitmoji Command Examples
  • gitlint Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright