From 348eacf3d1758d1e2a6816dd62c9ffcc2db975b0 Mon Sep 17 00:00:00 2001 From: "Isaac A. Murchie" Date: Mon, 12 Feb 2018 15:03:11 -0500 Subject: [PATCH] Move to minimum node 6 (#10180) --- lib/config.js | 8 ++++---- package.json | 2 +- test/config-specs.js | 32 ++++++++++++-------------------- test/driver-e2e-specs.js | 17 +++++++++++++++-- 4 files changed, 32 insertions(+), 27 deletions(-) diff --git a/lib/config.js b/lib/config.js index b8c80d23e..682cab9b1 100644 --- a/lib/config.js +++ b/lib/config.js @@ -38,16 +38,16 @@ async function getAppiumConfig () { function checkNodeOk () { let [major, minor] = getNodeVersion(); - if (major < 5) { - let msg = `Node version must be >= 5. Currently ${major}.${minor}`; + if (major < 6) { + let msg = `Node version must be >= 6. Currently ${major}.${minor}`; logger.errorAndThrow(msg); } } function warnNodeDeprecations () { let [major] = getNodeVersion(); - if (major < 4) { - logger.warn("Appium support for versions of node < 4 has been " + + if (major < 8) { + logger.warn("Appium support for versions of node < 8 has been " + "deprecated and will be removed in a future version. Please " + "upgrade!"); } diff --git a/package.json b/package.json index da4046dd6..526f01cb4 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "url": "https://github.com/appium/appium/issues" }, "engines": { - "node": ">=5", + "node": ">=6", "npm": ">=3" }, "main": "./build/lib/main.js", diff --git a/test/config-specs.js b/test/config-specs.js index 1ddd3d672..8063f77e0 100644 --- a/test/config-specs.js +++ b/test/config-specs.js @@ -64,7 +64,7 @@ describe('Config', function () { process = _process; }); describe('checkNodeOk', function () { - it('should fail if node is below 4', function () { + it('should fail if node is below 6', function () { process.version = 'v4.4.7'; checkNodeOk.should.throw(); process.version = 'v0.9.12'; @@ -75,10 +75,8 @@ describe('Config', function () { checkNodeOk.should.throw(); process.version = 'v0.12.14'; checkNodeOk.should.throw(); - }); - it('should succeed if node is 5+', function () { process.version = 'v5.7.0'; - checkNodeOk.should.not.throw(); + checkNodeOk.should.throw(); }); it('should succeed if node is 6+', function () { process.version = 'v6.3.1'; @@ -92,6 +90,10 @@ describe('Config', function () { process.version = 'v8.1.2'; checkNodeOk.should.not.throw(); }); + it('should succeed if node is 9+', function () { + process.version = 'v9.1.2'; + checkNodeOk.should.not.throw(); + }); }); describe('warnNodeDeprecations', function () { @@ -102,28 +104,18 @@ describe('Config', function () { beforeEach(function () { spy.reset(); }); - it('should log a warning if node is below 4', function () { - process.version = 'v0.9.12'; + it('should log a warning if node is below 8', function () { + process.version = 'v7.10.1'; warnNodeDeprecations(); logger.warn.callCount.should.equal(1); }); - it('should log a warning if node is 0.12', function () { - process.version = 'v0.12.0'; - warnNodeDeprecations(); - logger.warn.callCount.should.equal(1); - }); - it('should not log a warning if node is 4+', function () { - process.version = 'v4.4.7'; + it('should not log a warning if node is 8+', function () { + process.version = 'v8.0.0'; warnNodeDeprecations(); logger.warn.callCount.should.equal(0); }); - it('should not log a warning if node is 5+', function () { - process.version = 'v5.7.0'; - warnNodeDeprecations(); - logger.warn.callCount.should.equal(0); - }); - it('should not log a warning if node is 6+', function () { - process.version = 'v6.3.1'; + it('should not log a warning if node is 9+', function () { + process.version = 'v9.0.0'; warnNodeDeprecations(); logger.warn.callCount.should.equal(0); }); diff --git a/test/driver-e2e-specs.js b/test/driver-e2e-specs.js index 06e956c85..1b2fed9f9 100644 --- a/test/driver-e2e-specs.js +++ b/test/driver-e2e-specs.js @@ -150,6 +150,9 @@ describe('FakeDriver - via HTTP', function () { ...caps, w3cParam: 'w3cParam', }); + + // End session + await request.delete({ url: `${baseUrl}/${value.sessionId}` }).should.eventually.be.resolved; }); it('should accept a combo of W3C and JSONWP but use JSONWP if desiredCapabilities contains extraneous keys', async function () { @@ -176,6 +179,9 @@ describe('FakeDriver - via HTTP', function () { automationName: 'Fake', anotherParam: 'Hello', }); + + // End session + await request.delete({ url: `${baseUrl}/${value.sessionId}` }).should.eventually.be.resolved; }); it('should reject bad W3C capabilities with a BadParametersError (400)', async function () { @@ -207,6 +213,9 @@ describe('FakeDriver - via HTTP', function () { should.not.exist(status); should.not.exist(sessionId); value.capabilities.should.deep.equal(caps); + + // End session + await request.delete({ url: `${baseUrl}/${value.sessionId}` }).should.eventually.be.resolved; }); it('should fall back to MJSONWP if w3c caps are invalid', async function () { @@ -226,6 +235,9 @@ describe('FakeDriver - via HTTP', function () { status.should.exist; sessionId.should.exist; value.should.deep.equal(caps); + + // End session + await request.delete({ url: `${baseUrl}/${value.sessionId}` }).should.eventually.be.resolved; }); }); }); @@ -248,8 +260,9 @@ describe('Logsink', function () { it('should send logs to a logHandler passed in by a parent package', async function () { logs.length.should.be.above(1); - logs[0].length.should.equal(2); - logs[0][1].should.include("Welcome to Appium"); + let welcomeIndex = logs[0][1].includes('versions of node') ? 1 : 0; + logs[welcomeIndex].length.should.equal(2); + logs[welcomeIndex][1].should.include("Welcome to Appium"); }); });