Skip to content
This repository has been archived by the owner on Jun 5, 2020. It is now read-only.

Commit

Permalink
Merge pull request #18 from dwittner/master
Browse files Browse the repository at this point in the history
Fix for issue #342, Tests being skipped when extending Object.prototype
  • Loading branch information
cjohansen committed Sep 10, 2013
2 parents 321c57c + c70de06 commit 2f4471e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
11 changes: 7 additions & 4 deletions lib/test-runner.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
((typeof define === "function" && define.amd && function (m) {
define("buster-test/test-runner", ["bane", "when", "lodash", "async", "platform"], m);
define("buster-test/test-runner",
["bane", "when", "lodash", "async", "platform"], m);
}) || (typeof module === "object" &&
typeof require === "function" && function (m) {
require("./seedrandom");
Expand Down Expand Up @@ -140,14 +141,14 @@
}

function unsatiesfiedRequirements(context) {
var name, requirements = context.requiresSupportForAll || {};
var name, requirements = context.requiresSupportForAll;
for (name in requirements) {
if (!satiesfiesRequirement(requirements[name])) {
return [name];
}
}
var unsatiesfied = [];
requirements = context.requiresSupportForAny || {};
requirements = context.requiresSupportForAny;
for (name in requirements) {
if (satiesfiesRequirement(requirements[name])) {
return [];
Expand Down Expand Up @@ -641,6 +642,8 @@
}
});

TestRunner.prototype.nextTick = nextTick || function (cb) { setTimeout(cb, 0); };
TestRunner.prototype.nextTick = nextTick ||
function (cb) { setTimeout(cb, 0); };

return TestRunner.prototype;
});
15 changes: 14 additions & 1 deletion test/test-runner-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2175,7 +2175,20 @@
this.runSuite([context], done(function (listeners) {
assert(listeners["context:unsupported"].calledOnce);
}));
}
},

"does not emit context:unsupported due to extended Object.prototype":
function (done) {
Object.prototype.mixin = function () {};

var context = testCase("Test", {
"test": this.test
});

this.runSuite([context], done(function (listeners) {
assert(listeners["context:unsupported"].notCalled);
}));
}
});

helper.testCase("TestRunnerEventDataTest", {
Expand Down

0 comments on commit 2f4471e

Please sign in to comment.