فهرست منبع

Fixed JS testing with multiple configs.

Andy Li 10 سال پیش
والد
کامیت
0712dd9d76
2فایلهای تغییر یافته به همراه22 افزوده شده و 3 حذف شده
  1. 10 3
      tests/RunCi.hx
  2. 12 0
      tests/unit/src/RunSauceLabs.hx

+ 10 - 3
tests/RunCi.hx

@@ -634,10 +634,17 @@ class RunCi {
 
 							runCommand("haxe", ["compile-js.hxml"].concat(extras));
 
-							var output = "bin/unit" + extras.join("") + ".js";
-							if (extras.length > 0) {
-								File.copy("bin/unit.js", output);
+							var output = if (extras.length > 0) {
+								"bin/js/" + extras.join("") + "/unit.js";
+							} else {
+								"bin/js/default/unit.js";
 							}
+							var outputDir = Path.directory(output);
+							if (!FileSystem.exists(outputDir)) {
+								FileSystem.createDirectory(outputDir);
+							}
+							FileSystem.rename("bin/unit.js", output);
+							FileSystem.rename("bin/unit.js.map", output + ".map");
 							runCommand("node", ["-e", "var unit = require('./" + output + "').unit; unit.Test.main(); process.exit(unit.Test.success ? 0 : 1);"]);
 							output;
 						}

+ 12 - 0
tests/unit/src/RunSauceLabs.hx

@@ -25,6 +25,7 @@ private typedef Promise = {
 		-browsers <browsers>		A list of browsers to test with in JSON format. Default: refer to source code
 
 	When a test finishes, it should set `window.success` to a boolean.
+	For urls with the string `-es5`, IE <= 8 will be automatically skipped.
 */
 class RunSauceLabs {
 	static function successMsg(msg:String):Void {
@@ -37,6 +38,12 @@ class RunSauceLabs {
 		console.log('\x1b[36m' + msg + '\x1b[0m');
 	}
 
+	static function isEs5(b:Dynamic):Bool {
+		return 
+			// not IE <= 8
+			!(b.browserName == "internet explorer" && Std.parseInt(b.version) <= 8);
+	}
+
 	static function main():Void {
 		var serveDomain = "localhost";
 		var servePort = "2000";
@@ -211,6 +218,11 @@ class RunSauceLabs {
 			}
 
 			var browserSuccess = true;
+			var urls = if (!isEs5(caps)) {
+				urls.filter(function(url:String) return url.indexOf("-es5") < 0);
+			} else {
+				urls;
+			}
 
 			return browser
 				.init(caps)