Skip to content

Commit

Permalink
tests: run tests on node 6, 7 to detect mismatches to native Proxy be…
Browse files Browse the repository at this point in the history
…havior (except for known mismatches)
  • Loading branch information
dbo committed Nov 16, 2016
1 parent 3efd095 commit 4c471b8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
8 changes: 5 additions & 3 deletions tests/test-construct.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ describe("Proxy#construct", function() {
it("should have the correct target", function() {
assert.equal(x.target, x.fn);
});
it("should have the correct new.target", function() {
assert.equal(x.newTarget, x.fn);
});
if (Proxy.__shim) {
it("should have the correct new.target", function() {
assert.equal(x.newTarget, x.fn);
});
}
it("should have the correct args", function() {
assert.deepEqual(Array.from(x.args), [5, 6, 7]);
});
Expand Down
17 changes: 10 additions & 7 deletions tests/test-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,15 @@ describe("Proxy#set", function() {
});
});

describe("#new-properties", function() {
it("should fail on defining new properties", function() {
assert.throws(function() {
var p = new Proxy({}, {});
p.goo = 5;
}, TypeError);

if (Proxy.__shim) {
describe("#new-properties", function() {
it("should fail on defining new properties", function() {
assert.throws(function() {
var p = new Proxy({}, {});
p.goo = 5;
}, TypeError);
});
});
});
}
});
14 changes: 8 additions & 6 deletions tests/test-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
require("./setup.js");
var assert = require("assert");

describe("Proxy#unsupported-traps", function() {
it("should fail on unsupported traps", function() {
assert.throws(function() {
new Proxy({}, { get: function() {}, ownKeys: function() {} });
}, TypeError);
if (Proxy.__shim) {
describe("Proxy#unsupported-traps", function() {
it("should fail on unsupported traps", function() {
assert.throws(function() {
new Proxy({}, { get: function() {}, ownKeys: function() {} });
}, TypeError);
});
});
});
}

0 comments on commit 4c471b8

Please sign in to comment.