瀏覽代碼

[CI] test with and without `-D js-classic`.

Andy Li 10 年之前
父節點
當前提交
a5b58ce8e8
共有 3 個文件被更改,包括 21 次插入8 次删除
  1. 8 3
      tests/RunCi.hx
  2. 4 1
      tests/unit/src/RunSauceLabs.hx
  3. 9 4
      tests/unit/unit-js.html

+ 8 - 3
tests/RunCi.hx

@@ -647,10 +647,11 @@ class RunCi {
 					getJSDependencies();
 
 					var jsOutputs = [
-						for (es5 in [[], ["-D", "js-es5"]])
+						for (es5 in       [[], ["-D", "js-es5"]])
 						for (unflatten in [[], ["-D", "js-unflatten"]])
+						for (classic in   [[], ["-D", "js-classic"]])
 						{
-							var extras = [].concat(es5).concat(unflatten);
+							var extras = [].concat(es5).concat(unflatten).concat(classic);
 
 							runCommand("haxe", ["compile-js.hxml"].concat(extras));
 
@@ -671,7 +672,11 @@ class RunCi {
 					];
 
 					var env = Sys.environment();
-					if (env.exists("SAUCE_USERNAME") && env.exists("SAUCE_ACCESS_KEY")) {
+					if (
+						env.exists("SAUCE_USERNAME") && env.exists("SAUCE_ACCESS_KEY") &&
+						// only run on Linux build
+						(ci != null ? systemName == "Linux" : true)
+					) {
 						// sauce-connect should have been started
 
 						// var scVersion = "sc-4.3-linux";

+ 4 - 1
tests/unit/src/RunSauceLabs.hx

@@ -197,7 +197,7 @@ class RunSauceLabs {
 						.sauceJobUpdate({ passed: true, tags: tags.concat(["errored"]) })
 						.then(function() return browser.quit())
 						.timeout(commandTimeout * 1000)
-						.then(function() return testBrowser(caps, trials));
+						.fin(function() return testBrowser(caps, trials));
 				} else {
 					allSuccess = false;
 					return null;
@@ -284,6 +284,9 @@ class RunSauceLabs {
 			}, q())
 			.then(function() {
 				Sys.exit(allSuccess ? 0 : 1);
+			})
+			.fail(function() {
+				Sys.exit(1);
 			});
 	}
 }

+ 9 - 4
tests/unit/unit-js.html

@@ -13,10 +13,15 @@
             function getURLParameter(name) {
                 return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null
             }
-
-            var js = getURLParameter("js") || "bin/unit.js";
-            $.getScript(js, function() {
-                unit.Test.main();
+            $.ajax({
+                url: getURLParameter("js") || "bin/unit.js",
+                dataType: "script",
+                success: function() {
+                    unit.Test.main();
+                },
+                error: function(jqXHR, textStatus, errorThrown) {
+                    throw errorThrown;
+                }
             });
         </script>
     </body>