I'm trying to use Wallaby with LoopbackJS and last couple of hours brought only failures. Maybe someone here already figured out how to do it. Here is my wallaby config that is closest to "it's working"
module.exports = function () {
return {
files: [
'server/**/*.js',
'common/**/*.js',
'test/global.js'
],
tests: [
'test/models/*.js',
'test/services/*.js'
],
workers: {
recycle: true //doesn't matter whats set here
},
bootstrap: function (wallaby) {
// try number 1
if (global.app) return;
var path = require('path');
var loopback = require('loopback');
var boot = require('loopback-boot');
wallaby.delayStart();
global.app = loopback();
// instead of __dirname I was trying also localProjectDir and projectCacheDir
boot(global.app, path.join(__dirname, 'server'), function () {
wallaby.start();
});
// try number 2
var path = require('path');
if (global.app) return;
global.app = require(path.join(wallaby.localProjectDir, 'server/server.js'));
},
env: {
type: 'node',
params: {
env: 'NODE_ENV=test'
}
}
};
};
Try number 1 starts but the app seems to be not configured. app.get('some-config') as well as app.models.myModel is always undefined. Try number 2 seems to be a bit better because it runs some tests but it throws the same errors as first one.