Skip to content

Commit c75caf4

Browse files
authored
Merge pull request #303 from web-push-libs/update_deps
Update some dependencies
2 parents e1ccd54 + ba283fb commit c75caf4

File tree

9 files changed

+2215
-1451
lines changed

9 files changed

+2215
-1451
lines changed

.eslintrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
"no-param-reassign": 0,
1616
"quote-props": 0,
1717
"wrap-iife": [2, "inside"],
18-
"import/no-unresolved": 0
18+
"import/no-unresolved": 0,
19+
"indent": 0,
20+
"no-buffer-constructor": 0, // We still support Node v4.
1921
}
2022
}

package-lock.json

Lines changed: 2165 additions & 1399 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,26 @@
2929
},
3030
"homepage": "https://github.com/web-push-libs/web-push#readme",
3131
"dependencies": {
32-
"asn1.js": "^4.8.1",
32+
"asn1.js": "^5.0.0",
3333
"http_ece": "^0.5.2",
3434
"jws": "^3.1.3",
3535
"minimist": "^1.2.0",
3636
"urlsafe-base64": "^1.0.0"
3737
},
3838
"devDependencies": {
39-
"chalk": "^1.1.3",
40-
"chromedriver": "2.24.1",
41-
"del": "^2.2.1",
42-
"eslint": "^3.5.0",
43-
"eslint-config-airbnb": "^11.1.0",
44-
"eslint-plugin-import": "^1.16.0",
45-
"geckodriver": "1.1.3",
39+
"chalk": "^2.3.0",
40+
"chromedriver": "^2.33.2",
41+
"del": "^3.0.0",
42+
"eslint": "^4.12.1",
43+
"eslint-config-airbnb": "^16.1.0",
44+
"eslint-plugin-import": "^2.8.0",
45+
"geckodriver": "^1.10.0",
4646
"istanbul": "^0.4.2",
4747
"mkdirp": "^0.5.1",
48-
"mocha": "^3.0.2",
48+
"mocha": "^4.0.1",
4949
"portfinder": "^1.0.2",
50-
"selenium-assistant": "1.0.0",
51-
"selenium-webdriver": "3.0.0-beta-2",
50+
"selenium-assistant": "^5.2.0",
51+
"selenium-webdriver": "^3.6.0",
5252
"semver": "^5.1.0",
5353
"sinon": "^4.0.1",
5454
"which": "^1.2.11"

src/cli.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#! /usr/bin/env node
2-
/* eslint consistent-return:0*/
2+
/* eslint consistent-return:0 */
3+
34
'use strict';
45

56
const webPush = require('../src/index.js');

src/web-push-lib.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,7 @@ WebPushLib.prototype.generateRequestDetails =
177177
'required encryption keys'));
178178
}
179179

180-
const encrypted = encryptionHelper.encrypt(
181-
subscription.keys.p256dh, subscription.keys.auth, payload);
180+
const encrypted = encryptionHelper.encrypt(subscription.keys.p256dh, subscription.keys.auth, payload);
182181

183182
requestDetails.headers['Content-Length'] = encrypted.cipherText.length;
184183
requestDetails.headers['Content-Type'] = 'application/octet-stream';
@@ -191,8 +190,7 @@ WebPushLib.prototype.generateRequestDetails =
191190
requestDetails.headers['Content-Length'] = 0;
192191
}
193192

194-
const isGCM = subscription.endpoint.indexOf(
195-
'https://android.googleapis.com/gcm/send') === 0;
193+
const isGCM = subscription.endpoint.indexOf('https://android.googleapis.com/gcm/send') === 0;
196194
// VAPID isn't supported by GCM hence the if, else if.
197195
if (isGCM) {
198196
if (!currentGCMAPIKey) {
@@ -247,8 +245,7 @@ WebPushLib.prototype.sendNotification =
247245
function(subscription, payload, options) {
248246
let requestDetails;
249247
try {
250-
requestDetails = this.generateRequestDetails(
251-
subscription, payload, options);
248+
requestDetails = this.generateRequestDetails(subscription, payload, options);
252249
} catch (err) {
253250
return Promise.reject(err);
254251
}
@@ -272,8 +269,10 @@ WebPushLib.prototype.sendNotification =
272269

273270
pushResponse.on('end', function() {
274271
if (pushResponse.statusCode < 200 || pushResponse.statusCode > 299) {
275-
reject(new WebPushError('Received unexpected response code',
276-
pushResponse.statusCode, pushResponse.headers, responseText, requestDetails.endpoint));
272+
reject(new WebPushError(
273+
'Received unexpected response code',
274+
pushResponse.statusCode, pushResponse.headers, responseText, requestDetails.endpoint
275+
));
277276
} else {
278277
resolve({
279278
statusCode: pushResponse.statusCode,

test/data/demo/service-worker.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/* Needed because of https://github.com/airbnb/javascript/issues/1632 */
2+
/* eslint no-restricted-globals: 0 */
3+
14
'use strict';
25

36
let port;

test/helpers/download-test-browsers.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
'use strict';
22

3+
// The latest version of Selenium doesn't support Node 4.
4+
const semver = require('semver');
5+
if (!semver.gte(process.version, '5.0.0')) {
6+
return;
7+
}
8+
39
const seleniumAssistant = require('selenium-assistant');
410

511
const MAX_RETRIES = 3;
6-
let forceDownload = false;
12+
let expiration;
713
if (process.env.TRAVIS) {
8-
forceDownload = true;
14+
expiration = 0;
915
}
1016

1117
const downloadBrowser = (name, version, attempt) => {
1218
attempt = attempt || 0;
1319

1420
return new Promise((resolve, reject) => {
15-
seleniumAssistant.downloadBrowser(name, version, forceDownload)
21+
seleniumAssistant.downloadLocalBrowser(name, version, expiration)
1622
.catch((err) => {
1723
if (attempt < MAX_RETRIES) {
1824
console.log(`Attempt ${attempt + 1} of browser ${name} - ${version} failed.`);

test/test-vapid-helper.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,13 @@ suite('Test Vapid Helpers', function() {
152152
test('should get valid VAPID headers', function() {
153153
const validInputs = [
154154
function() {
155-
return vapidHelper.getVapidHeaders(VALID_AUDIENCE, VALID_SUBJECT_URL,
156-
VALID_PUBLIC_KEY, VALID_PRIVATE_KEY);
155+
return vapidHelper.getVapidHeaders(VALID_AUDIENCE, VALID_SUBJECT_URL, VALID_PUBLIC_KEY, VALID_PRIVATE_KEY);
157156
},
158157
function() {
159-
return vapidHelper.getVapidHeaders(VALID_AUDIENCE, VALID_SUBJECT_MAILTO,
160-
VALID_PUBLIC_KEY, VALID_PRIVATE_KEY);
158+
return vapidHelper.getVapidHeaders(VALID_AUDIENCE, VALID_SUBJECT_MAILTO, VALID_PUBLIC_KEY, VALID_PRIVATE_KEY);
161159
},
162160
function() {
163-
return vapidHelper.getVapidHeaders(VALID_AUDIENCE, VALID_SUBJECT_URL,
164-
VALID_PUBLIC_KEY, VALID_PRIVATE_KEY, VALID_EXPIRATION);
161+
return vapidHelper.getVapidHeaders(VALID_AUDIENCE, VALID_SUBJECT_URL, VALID_PUBLIC_KEY, VALID_PRIVATE_KEY, VALID_EXPIRATION);
165162
},
166163
function() {
167164
// 0 is a valid value for `expiration`

test/testSelenium.js

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
'use strict';
22

3+
// The latest version of Selenium doesn't support Node 4.
4+
const semver = require('semver');
5+
if (!semver.gte(process.version, '5.0.0')) {
6+
return;
7+
}
8+
39
const seleniumAssistant = require('selenium-assistant');
410
const webdriver = require('selenium-webdriver');
511
const seleniumFirefox = require('selenium-webdriver/firefox');
@@ -35,19 +41,7 @@ let testServerURL;
3541
function runTest(browser, options) {
3642
options = options || {};
3743

38-
if (browser.getSeleniumBrowserId() === 'firefox' &&
39-
browser.getVersionNumber() <= 48 &&
40-
process.env.TRAVIS === 'true') {
41-
console.log('');
42-
console.warn(chalk.red(
43-
'Running on Travis so skipping firefox tests as ' +
44-
'they don\'t currently work.'
45-
));
46-
console.log('');
47-
return Promise.resolve();
48-
}
49-
50-
if (browser.getSeleniumBrowserId() === 'firefox' &&
44+
if (browser.getId() === 'firefox' &&
5145
process.env.TRAVIS === 'true') {
5246
try {
5347
which.sync('geckodriver');
@@ -56,10 +50,7 @@ function runTest(browser, options) {
5650
// don't have the GH_TOKEN
5751
if (process.env.TRAVIS_PULL_REQUEST !== false) {
5852
console.log('');
59-
console.warn(chalk.red(
60-
'Running on Travis OS X so skipping firefox tests as ' +
61-
'they don\'t currently work.'
62-
));
53+
console.warn(chalk.red('Running on Travis OS X so skipping firefox tests as they don\'t currently work.'));
6354
console.log('');
6455
return Promise.resolve();
6556
}
@@ -71,15 +62,15 @@ function runTest(browser, options) {
7162
globalServer = server;
7263
testServerURL = 'http://127.0.0.1:' + server.port;
7364

74-
if (browser.getSeleniumBrowserId() === 'firefox') {
65+
if (browser.getId() === 'firefox') {
7566
// This is based off of: https://bugzilla.mozilla.org/show_bug.cgi?id=1275521
7667
// Unfortunately it doesn't seem to work :(
7768
const ffProfile = new seleniumFirefox.Profile();
7869
ffProfile.setPreference('dom.push.testing.ignorePermission', true);
7970
ffProfile.setPreference('notification.prompt.testing', true);
8071
ffProfile.setPreference('notification.prompt.testing.allow', true);
8172
browser.getSeleniumOptions().setProfile(ffProfile);
82-
} else if (browser.getSeleniumBrowserId() === 'chrome') {
73+
} else if (browser.getId() === 'chrome') {
8374
const chromeOperaPreferences = {
8475
profile: {
8576
content_settings: {
@@ -199,10 +190,9 @@ function runTest(browser, options) {
199190

200191
seleniumAssistant.printAvailableBrowserInfo();
201192

202-
const availableBrowsers = seleniumAssistant.getAvailableBrowsers();
193+
const availableBrowsers = seleniumAssistant.getLocalBrowsers();
203194
availableBrowsers.forEach(function(browser) {
204-
if (browser.getSeleniumBrowserId() !== 'chrome' &&
205-
browser.getSeleniumBrowserId() !== 'firefox') {
195+
if (browser.getId() !== 'chrome' && browser.getId() !== 'firefox') {
206196
return;
207197
}
208198

0 commit comments

Comments
 (0)