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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • 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. CentOS / RHEL 7 : How to boot into rescue mode from installation DVD/ISO
  2. dsniff Command Examples in Linux
  3. /proc/cpuinfo file explained
  4. How to use auditd to monitor a file deletion in Linux
  5. ClusterSSH(cssh) – Manage Multiple SSH Sessions on Linux
  6. restorecon: command not found
  7. How to Use the ssh-keygen Command to configure passwordless ssh
  8. Understanding Samba utilities – nmblookup, smbstatus, smbtar, testparm, wbinfo, smbget
  9. How to extend ASM disk from OS level in CentOS/RHEL
  10. fsck: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • raw: command not found
  • raw Command Examples in Linux
  • rankmirrors Command Examples in Linux
  • radeontop: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright