Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test framework deps #778

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions config/lib/mongoose.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ module.exports.connect = function (callback) {
// https://mongodb.github.io/node-mongodb-native/2.1/api/Server.html
// http://mongoosejs.com/docs/connections.html
var mongoConnectionOptions = {
server: {
// Never stop reconnecting
reconnectTries: Number.MAX_VALUE
}
reconnectTries: Number.MAX_VALUE
};

async.waterfall([
Expand Down
56 changes: 28 additions & 28 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,36 +418,36 @@ function mocha(done) {
var testSuites = changedTestFiles.length ? changedTestFiles : testAssets.tests.server;
var error;

// Connect mongoose
mongooseService.connect(function (db) {
// Clean out test database to have clean base
mongooseService.dropDatabase(db, function () {
mongooseService.loadModels();

// Run the tests
gulp.src(testSuites)
.pipe(plugins.mocha({
reporter: 'spec',
timeout: 10000
}))
.on('error', function (err) {
// If an error occurs, save it
error = err;
console.error(err);
})
.on('end', function () {
// When the tests are done, disconnect agenda/mongoose
// and pass the error state back to gulp
// @TODO: https://github.com/Trustroots/trustroots/issues/438
// @link https://github.com/agenda/agenda/pull/450
agenda._mdb.close(function () {
mongooseService.disconnect(function () {
done(error);
});
});
gulp.src(testSuites)
.pipe(plugins.mocha({
reporter: 'spec',
timeout: 10000,
delay: true,
exit: true,
file: './testutils/loadmodels.testutil'
}))
.on('error', function (err) {
// If an error occurs, save it
error = err;
console.error(err);
// Close the DB connection
agenda._mdb.close(function () {
mongooseService.disconnect(function () {
done(error);
});
});
})
.on('end', function () {
// When the tests are done, disconnect agenda/mongoose
// and pass the error state back to gulp
// @TODO: https://github.com/Trustroots/trustroots/issues/438
// @link https://github.com/agenda/agenda/pull/450
agenda._mdb.close(function () {
mongooseService.disconnect(function () {
done(error);
});
});
});
});
}

function karma(done) {
Expand Down