Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
124 lines (89 sloc) 2.64 KB

Inspec: A JavaScript BDD Test Framework

Inspec is a Javascript BDD Test Library that aims to be flexible and powerful yet clean and easy to extend. Packaged as a Narwhal Package.


You need:



Setup your path for narwhal

cd ~
mkdir ~/.bin
nano ~/.bash_profile

Add the following line at the end of your .bash_profile


Save your .bash_profile.
Update your environment variables by running the following in the console:

source ~/.bash_profile

Get narwhal

cd ~ && mkdir serverjs
cd ~/serverjs
git clone git://

Get Inspec

cd ~/serverjs/narwhal/packages
git clone git://

Link narwhal and Inspec executables to your bin folder

cd ~/.bin
ln -s ~/serverjs/narwhal/bin/* .
ln -s ~/serverjs/narwhal/packages/inspec/bin/* .

Run Inspec self test

cd ~/serverjs/narwhal/packages/inspec

Specing your own

  1. Make a directory called ‘spec’
  2. Your spec files should be in spec folder and/or its subfolders
  3. Inspec looks for files with name ending with ‘Spec.js’. E.g. ‘fooSpec.js’, ‘barSpec.js’
  4. type ‘inspec’ on the parent directory of ‘spec’ to see test results


  • Nested Example Groups
  • Shared Example Groups (A.K.A. it_should_behave_like in RSpec )
  • support multiple definition of before / after blocks (add array)
  • support multiple definition of same behaviors (see below)
  • Sandboxed Example Scope
  • Cascading beforeEach, beforeAll, afterEach, afterAll
  • Clean API
  • Easy to extend

Sample spec

Highly suggest you to look at the spec directory for more sample code on specing

sharedExamplesFor("a shared example group", function(){
  it("should work as shared example", function(){

  describe("with nested example groups in shared", function(){
    it("should work as a nested example group in shared", function(){


describe("Inspec", function(){
  it("should work", function(){
  it("should fail", function(){

  it("should error", function(){
  it("should be pending")
  describe("with a nested example group", function(){
    it("should work as a nested example group", function(){

  itShouldBehaveLike("a shared example group")