windchime
windchime

Reputation: 1285

mocha async is not defined

I am using mocha to test code written in NodeJS.

The code being tested, target, uses async.

function target(){
    ...
    async.waterfall([...]);
}

When I call it from it function in

it('should do something', function(){
    var result = target();  
    chai.expect(newAd0.coarseloc.longitude).to.be.within(-79.01,-78.99);
})

mocha complains that

ReferenceError: async is not defined

What should I do to solve this problem?

Upvotes: 0

Views: 676

Answers (1)

Yuri Zarubin
Yuri Zarubin

Reputation: 11677

async is an npm package, install the package using npm install async.

Add this at the top of your file:

var async = require('async');

Upvotes: 3

Related Questions