diff --git a/test/support/test_helper.js b/test/support/test_helper.js index 49c6c1ee..96a109ff 100644 --- a/test/support/test_helper.js +++ b/test/support/test_helper.js @@ -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() { diff --git a/test/unit/cartodb/ported/tile_stats.test.js b/test/unit/cartodb/ported/tile_stats.test.js index 3fbf93ec..a2d30cd0 100644 --- a/test/unit/cartodb/ported/tile_stats.test.js +++ b/test/unit/cartodb/ported/tile_stats.test.js @@ -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); } });