From 0c745d68259b40d3f0d8995f8bcc4874fb03cf0f Mon Sep 17 00:00:00 2001 From: Mike Morris Date: Thu, 12 Mar 2015 16:18:29 -0400 Subject: [PATCH] catch errors only in gzip tests, not all log messages --- test/js/gzip.test.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/js/gzip.test.js b/test/js/gzip.test.js index 6866db059..6fabc09bd 100644 --- a/test/js/gzip.test.js +++ b/test/js/gzip.test.js @@ -60,7 +60,7 @@ function getFileSource(gzip, t) { test('gzip', function(t) { t.test('success', function(t) { mbgl.on('message', function(msg) { - t.error(msg); + if (msg.severity == 'ERROR') t.error(msg); }); setup(getFileSource(true, t), function(map) { @@ -92,16 +92,19 @@ test('gzip', function(t) { }); t.test('unhandled', function(t) { - mbgl.once('message', function(msg) { - t.ok(msg, 'emits error'); - t.equal(msg.class, 'ParseTile'); - t.equal(msg.severity, 'ERROR'); - t.ok(msg.text.match(/failed: pbf unknown field type exception/), 'pbf unknown field type exception'); + mbgl.on('message', function(msg) { + if (msg.severity == 'ERROR') { + t.ok(msg, 'emits error'); + t.equal(msg.class, 'ParseTile'); + t.equal(msg.severity, 'ERROR'); + t.ok(msg.text.match(/failed: pbf unknown field type exception/), 'pbf unknown field type exception'); + } }); setup(getFileSource(false, t), function(map) { map.load(style); map.render({}, function(err, image) { + mbgl.removeAllListeners('message'); mbgl.compressPNG(image, function(err, image) { t.error(err);