diff --git a/bin/jsx b/bin/jsx index 5e269cda97..aa6ae90ab8 100755 --- a/bin/jsx +++ b/bin/jsx @@ -41,6 +41,7 @@ require("commoner").resolve(function(id) { return context.getProvidedP().then(function(idToPath) { if (id !== "mock-modules" && id !== "mocks" && + id !== "test/all" && idToPath.hasOwnProperty("mock-modules")) { return source + '\nrequire("mock-modules").register(' + JSON.stringify(id) + ', module);\n'; diff --git a/grunt/config/populist.js b/grunt/config/populist.js index 82d6067b15..342d09b0b5 100644 --- a/grunt/config/populist.js +++ b/grunt/config/populist.js @@ -11,7 +11,7 @@ var jasmine = { var test = { rootDirectory: "build/modules", - args: ["test/all:"], + args: ["test/all:harness"], requires: [ "**/__tests__/*-test.js" ], diff --git a/src/test/all.js b/src/test/all.js index 3b3a3639a9..a94a58062d 100644 --- a/src/test/all.js +++ b/src/test/all.js @@ -6,9 +6,6 @@ var Ap = Array.prototype; var slice = Ap.slice; var Fp = Function.prototype; -var global = Function("return this")(); -global.require = require; - if (!Fp.bind) { // PhantomJS doesn't support Function.prototype.bind natively, so // polyfill it whenever this module is required. @@ -58,3 +55,7 @@ require("reactComponentExpect"); require("mocks"); require("mock-modules"); require("./mock-timers"); + +exports.enableTest = function(testID) { + require("../" + testID); +}; diff --git a/test/frame.html b/test/frame.html deleted file mode 100644 index 34061d7ce1..0000000000 --- a/test/frame.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/test/index.html b/test/index.html index fb015dcd08..098874a4b6 100644 --- a/test/index.html +++ b/test/index.html @@ -2,21 +2,13 @@ - - + + diff --git a/test/phantom-harness.js b/test/phantom-harness.js index 6dcfced557..c07142ccad 100644 --- a/test/phantom-harness.js +++ b/test/phantom-harness.js @@ -34,14 +34,13 @@ while (argv.length > 0) { rest.push(arg); } -// Dynamically interpolate the individual test '; - }).join("") + inner + ""; + /^(\s*)ENABLE_TESTS_HERE/m, + function(placeholder, leadingSpace) { + return leadingSpace + tests.map(function(testID) { + return "harness.enableTest(" + JSON.stringify(testID) + ");"; + }).join("\n" + leadingSpace); } ); @@ -63,9 +62,6 @@ server.listen(port, function(req, res) { file = "../build/" + file; break; - case "frame.html": - break; - case "": default: file = "index.html";