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:
commit
cd8e320534
@ -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() {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user