I am having a gulp based project, and use browserify
and debowerify
to build the application. The application
- Depends on Backbone - installed as bower component.
- Has some additional domain classes which
require
sbackbone
.
I build 1
above as vendor.js
and 2
above as app.js
,and include both these files in the html file, which runs fine
Now I am about to set up testing using tape, and I started off with testing the model
class:
var todoModel = require('../../libs/todo/model/todo.js').Todo;
var test = require('tape');
var aTodo = new todoModel();
test('todo model test',function(t){
eyes.inspect(atodo, "one");
t.equal(1,one.valueOf(),'one should be equal to one');
t.end();
});
libs/todo/model/todo.js:
var Backbone = require('backbone');
var Storage = require('../helpers/storage.js');
var Todo = Backbone.Model.extend({
...
})
When I run this test as tape test/model-test.js
, I am getting an (expteced) error as
Error: Cannot find module 'backbone'
. So now, how do I make the bower candidate backbone
be available to my node.js test script
Note: A simple workaround is to add the backbone
as a node dependency, but what if a hypothetical library is available only in bower?