Merge pull request #831 from CartoDB/fail-on-uncaught-exceptions

Make tests to fail if they got an uncaught exception
This commit is contained in:
Raul Ochoa 2017-12-28 19:15:29 +01:00 committed by GitHub
commit cd8e320534
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View File

@ -75,6 +75,22 @@ function checkSurrogateKey(res, expectedKey) {
assert.deepEqual(keys, expectedKeys);
}
var uncaughtExceptions = [];
process.on('uncaughtException', function(err) {
uncaughtExceptions.push(err);
});
beforeEach(function() {
uncaughtExceptions = [];
});
//global afterEach to capture uncaught exceptions
afterEach(function() {
assert.equal(
uncaughtExceptions.length,
0,
'uncaughtException:\n\n' + uncaughtExceptions.map(err => err.stack).join('\n\n'));
});
var redisClient;
beforeEach(function() {

View File

@ -11,7 +11,7 @@ describe('tile stats', function() {
});
afterEach(function() {
global.statsClient = this.statsClient;
global.statsClient = this.statsClient;
});
it('finalizeGetTileOrGrid does not call statsClient when format is not supported', function() {
@ -84,7 +84,7 @@ describe('tile stats', function() {
});
function mockStatsClientGetInstance(instance) {
global.statsClient = instance;
global.statsClient = Object.assign(global.statsClient, instance);
}
});