From e9437cc4fc137e3024163c59349866d1f30235ac Mon Sep 17 00:00:00 2001 From: Johannes Ewald Date: Tue, 10 Apr 2018 00:31:49 +0200 Subject: Drop official node v4 support --- .travis.yml | 1 - testLib/sharedTestCases.js | 25 ++++++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5f98a89..bd4662b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: node_js node_js: - - "4" - "6" - "8" - "9" diff --git a/testLib/sharedTestCases.js b/testLib/sharedTestCases.js index aa18516..6cd9b2e 100644 --- a/testLib/sharedTestCases.js +++ b/testLib/sharedTestCases.js @@ -13,6 +13,23 @@ var expect = require("expect.js"), __get__Src = require("../lib/__get__.js").toString(), __with__Src = require("../lib/__with__.js").toString(); +var supportsObjectSpread = (function () { + try { + eval("({...{}})"); + return true; + } catch (err) { + return false; + } +})(); +var supportsObjectRest = (function () { + try { + eval("const {...a} = {}"); + return true; + } catch (err) { + return false; + } +})(); + function checkForTypeError(err) { expect(err.constructor).to.be(TypeError); } @@ -232,11 +249,11 @@ module.exports = function () { rewire("./sealedObject.js"); // should not throw }); - it("should not be a problem to have a module that uses object spread operator", function () { + (supportsObjectSpread ? it : it.skip)("should not be a problem to have a module that uses object spread operator", function () { rewire("./objectSpreadOperator.js"); // should not throw }); - it("should not be a problem to have a module that uses object rest operator", function () { + (supportsObjectRest ? it : it.skip)("should not be a problem to have a module that uses object rest operator", function () { rewire("./objectRestOperator.js"); // should not throw }); @@ -263,9 +280,7 @@ module.exports = function () { try { throwError(); } catch (err) { - if (err.stack) { - expect(err.stack.split("\n")[1]).to.match(/:6:26/); - } + expect(err.stack.split("\n")[1]).to.match(/:6:26/); } }); -- cgit v1.2.3