Hello as the title of the question. I was wondering how to check if the feedback scripts had finished before running the tests. In the example project:
https://github.com/strongloop/loopback-example-relations
there is a file in the test folder that seems to do the job, but unfortunately does not solve it.
start-server.js:
var app = require('../server/server');
module.exports = function(done) {
if (app.loaded) {
app.once('started', done);
app.start();
} else {
app.once('loaded', function() {
app.once('started', done);
app.start();
});
}
};
This script is loaded into the rest of the test APIs as follows:
before(function(done) {
require('./start-server');
done();
});
but the function is never called. Is this the right way to use this script?
I ended up with the following implementation:
before(function (done) {
if (app.booting) {
console.log('Waiting for app boot...');
app.on('booted', done);
} else {
done();
}
});
which works, but I was puzzled by the server startup script.
EDIT following @stalin's advice. I changed the function beforeas follows:
before(function(done) {
require('./start-server')(done);
});
else done .