Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/rewire.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ewald <johannes.ewald@peerigon.com>2018-04-10 01:31:49 +0300
committerJohannes Ewald <johannes.ewald@peerigon.com>2018-04-10 01:31:49 +0300
commite9437cc4fc137e3024163c59349866d1f30235ac (patch)
tree9596bea6b99ac9730ee89fa933568dccb6bc2274 /testLib
parent13cb24e35f670343d9ea6959f544e1d30cf8ea12 (diff)
Drop official node v4 support
Diffstat (limited to 'testLib')
-rw-r--r--testLib/sharedTestCases.js25
1 files changed, 20 insertions, 5 deletions
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/);
}
});