Reputation: 6340
I'd like to set the log level to ERROR when running unit, integration and acceptance tests. Is it possible to do this while keeping the default setting for the application in config/log.js unchanged?
Sails.js documentation recommends setting the log level to ERROR for tests but doesn't explain how you can do it. Is it possible by setting an environment variable or other means?
Thanks
Upvotes: 0
Views: 153
Reputation: 1621
If you want to set log level to 'error' only in your test you can do it by modifying your test/bootstrap.test.js
file.
before(function(done) {
this.timeout(5000);
Sails.lift({
log: {
level: 'error'
}
}, function(err, server) {
sails = server;
if (err) return done(err);
// here you can load fixtures, etc.
done(err, sails);
});
});
By that you can modify every setting from config
you want. For example i disabled csrf and 2 hooks i don't use. You can also change connection to database if needed in this place.
Upvotes: 1