From 8fced486d8490dd695632a7c997f73bb99c56b84 Mon Sep 17 00:00:00 2001 From: Miroslav Bajtos Date: Mon, 14 Nov 2016 12:40:45 +0200 Subject: [PATCH 1/3] Fix timeout in tests on Windows Rework the test waiting for connection failure to periodically check whether the error has been reported yet, instead of having a constant timeout value. --- test/apns.provider.test.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test/apns.provider.test.js b/test/apns.provider.test.js index b535c6b..8cc7fc3 100644 --- a/test/apns.provider.test.js +++ b/test/apns.provider.test.js @@ -154,6 +154,8 @@ describe('APNS provider', function() { }); it('emits "error" when gateway cannot be reached', function(done) { + var CONNECT_TIMEOUT = 2000; + this.timeout(1.5 * CONNECT_TIMEOUT); givenProviderWithConfig({ apns: { certData: objectMother.apnsDevCert(), @@ -169,15 +171,25 @@ describe('APNS provider', function() { provider.pushNotification(notification, aDeviceToken); + var start = Date.now(); + // wait for the provider to attempt to connect - setTimeout(function() { + // periodically check whether it has happened yet + var interval = setInterval(function() { + var elapsed = Date.now() - start; + if (!eventSpy.called && elapsed < CONNECT_TIMEOUT) + return; // still connecting + + clearInterval(interval); + expect(eventSpy.called, 'error event should be emitted') .to.equal(true); + var args = eventSpy.firstCall.args; expect(args[0]).to.be.instanceOf(Error); expect(args[0].code).to.equal('ECONNREFUSED'); done(); - }, 250); + }, 50); }); }); From c453d7ea1b108e63b6906bac3e8a5ef410c4f1c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Mon, 14 Nov 2016 12:07:59 +0100 Subject: [PATCH 2/3] Revert dev-dependency on loopback to 2.x LoopBack 3.x is dropping support for Node v0.10/v0.12, which we still support in 1.x branch of this component. If we stayed with LoopBack 3.x, then we would get CI failures on those two old platforms. --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 47a497a..385058d 100644 --- a/package.json +++ b/package.json @@ -30,8 +30,9 @@ "deep-extend": "^0.4.0", "eslint": "^2.13.1", "eslint-config-loopback": "^4.0.0", - "loopback": "^3.0.0", + "loopback": "^2.36.0", "loopback-connector-mongodb": "^1.8.0", + "loopback-datasource-juggler": "^2.53.0", "mocha": "^2.2.0", "should": "^6.0.0", "sinon": "^1.14.0" From c214cd20a1874dd1c8a2597a03ed09c1406ab1ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 16 Nov 2016 09:50:12 +0100 Subject: [PATCH 3/3] Set publish tag to "lts" --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index 385058d..e4010b0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,9 @@ { "name": "loopback-component-push", "version": "1.7.0", + "publishConfig": { + "tag": "lts" + }, "description": "Loopback Push Notification", "keywords": [ "StrongLoop Labs",