Merge pull request #209 from benjamn/speed-up-tests

Abandon <iframe> test isolation hack now that dumpCache works
This commit is contained in:
Paul O’Shannessy
2013-07-19 09:10:52 -07:00
6 changed files with 17 additions and 45 deletions
+1
View File
@@ -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';
+1 -1
View File
@@ -11,7 +11,7 @@ var jasmine = {
var test = {
rootDirectory: "build/modules",
args: ["test/all:"],
args: ["test/all:harness"],
requires: [
"**/__tests__/*-test.js"
],
+4 -3
View File
@@ -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);
};
-18
View File
@@ -1,18 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<script>
jasmine = parent.jasmine;
jasmine.exposeFrom(window);
console = parent.console;
callPhantom = parent.callPhantom;
</script>
<script src="react-test.js"></script>
</head>
<body>
<script>
require(window.frameElement.getAttribute("test"));
</script>
</body>
</html>
+5 -13
View File
@@ -2,21 +2,13 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="jasmine.css" />
<style type="text/css">
iframe {
visibility: hidden;
position: absolute;
left: -1000px;
top: -1000px;
}
</style>
<script src="jasmine.js"></script>
<script>
window.onload = function() {
jasmine.getEnv().execute();
};
</script>
<script src="react-test.js"></script>
</head>
<body>
<script>
ENABLE_TESTS_HERE
jasmine.getEnv().execute();
</script>
</body>
</html>
+6 -10
View File
@@ -34,14 +34,13 @@ while (argv.length > 0) {
rest.push(arg);
}
// Dynamically interpolate the individual test <iframe>s.
// Dynamically enable the individual tests.
var indexHtml = fs.read("index.html").replace(
/<body>([\s\S]*?)<\/body>/im,
function(outer, inner) {
return "<body>" + tests.map(function(test) {
return '\n <iframe src="frame.html" test=' +
JSON.stringify(test) + '></iframe>';
}).join("") + inner + "</body>";
/^(\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";