Using Jasmine and with the MEAN.JS structure

35 views
Skip to first unread message

Alexander Sloan

unread,
Feb 15, 2015, 4:12:12 PM2/15/15
to jasmi...@googlegroups.com
I'm struggling to get Jasmine set up and module/require working correctly. As per the examples, I can require in controllers without problem using something like:

var user =  require('../../app/controllers/users.server.controller');

However, this falls apart with require statements inside users.server.controller.js.  In MEAN.JS the user controller is just an aggregation of several controllers:

module.exports = _.extend(
require('./users/users.authentication.server'),
require('./users/users.authorization.server'),
require('./users/users.password.server'),
require('./users/users.profile.server')
);

The relatives paths seem to be incorrect when running Jasmine leading to module not found errors:

module.js:340
    throw err;
          ^
Error: Cannot find module './users/users.authentication.server'
    at Function.Module._resolveFilename (module.js:338:15)
    ...

Am I doing something wrong here? Is there a way to configure this so I don't have to change this structure?

Gerard Sans

unread,
Feb 16, 2015, 10:06:54 AM2/16/15
to jasmi...@googlegroups.com
It seems like this is a Require setup issue. You can play with some different config options like baseUrl and paths.


Hope it helps.
Gerard
Reply all
Reply to author
Forward
0 new messages