Permalink
Browse files

Cleaned up chutzpah tools

Also did formatting changes.
  • Loading branch information...
1 parent 5e1ad03 commit c926f865058c60eaac121b740a562d72d18bc39b @NTaylorMullen NTaylorMullen committed with davidfowl Aug 16, 2012

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -30,7 +30,7 @@
} catch (e) {
return false;
}
- } ())
+ }())
};
function Test(settings) {
@@ -559,7 +559,7 @@
QUnit = new F();
// Make F QUnit's constructor so that we can add to the prototype later
QUnit.constructor = F;
- } ());
+ }());
/**
* Config object: Maintain internal state
@@ -600,7 +600,7 @@
label: "No try-catch",
tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings."
}
- ],
+ ],
// logging callback queues
begin: [],
@@ -643,7 +643,7 @@
// Figure out if we're running the tests from a server or not
QUnit.isLocal = location.protocol === "file:";
- } ());
+ }());
// Export global variables, unless an 'exports' object exists,
// in that case we assume we're in CommonJS (dealt with on the bottom of the script)
@@ -1096,7 +1096,7 @@
document.title = [
(config.stats.bad ? "\u2716" : "\u2714"),
document.title.replace(/^[\u2714\u2716] /i, "")
- ].join(" ");
+ ].join(" ");
}
// clear own sessionStorage items if all tests passed
@@ -1500,7 +1500,7 @@
return eq && innerEquiv(aProperties.sort(), bProperties.sort());
}
};
- } ());
+ }());
innerEquiv = function () { // can take multiple arguments
var args = [].slice.apply(arguments);
@@ -1520,11 +1520,11 @@
}
// apply transition with (1..n) arguments
- } (args[0], args[1]) && arguments.callee.apply(this, args.splice(1, args.length - 1)));
+ }(args[0], args[1]) && arguments.callee.apply(this, args.splice(1, args.length - 1)));
};
return innerEquiv;
- } ());
+ }());
/**
* jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com |
@@ -1607,9 +1607,9 @@
} else if (obj.nodeType) {
type = "node";
} else if (
- // native arrays
+ // native arrays
toString.call(obj) === "[object Array]" ||
- // NodeList objects
+ // NodeList objects
(typeof obj.length === "number" && typeof obj.item !== "undefined" && (obj.length ? obj.item(0) === obj[0] : (obj.item(0) === null && typeof obj[0] === "undefined")))
) {
type = "array";
@@ -1739,7 +1739,7 @@
};
return jsDump;
- } ());
+ }());
// from Sizzle.js
function getText(elems) {
@@ -1923,12 +1923,12 @@
return str;
};
- } ());
+ }());
// for CommonJS enviroments, export everything
if (typeof exports !== "undefined") {
extend(exports, QUnit);
}
// get at whatever the global object is, like window in browsers
-} ((function () { return this; } .call())));
+}((function () { return this; }.call())));
@@ -6,25 +6,17 @@
-->
<configuration>
- <system.web>
- <compilation debug="true" targetFramework="4.5" />
- <httpRuntime targetFramework="4.5" />
- </system.web>
- <!--
- <JSResourceFolder>resources</JSResourceFolder>
- <JSTestFolder>tests</JSTestFolder>
- <JSCoreProject>SignalR.Client.JS</JSCoreProject>
- <UnitTestFolder>Tests</UnitTestFolder>
- -->
+ <system.web>
+ <compilation debug="true" targetFramework="4.5" />
+ <httpRuntime targetFramework="4.5" />
+ </system.web>
+
<appSettings>
- <!-- These keys are modified on build via MSBuild -->
+ <!-- These keys are modified on build via the .csproj -->
<add key="JSResourceFolder" value="resources"/>
- <add key="JSCoreProject" value="SignalR.Client.JS"/>
+ <add key="JSCoreProject" value="SignalR.Client.JS"/>
<add key="TempFolder" value="temp"/>
<add key="QUnitTestsFolder" value="Tests"/>
- <!-- Folder where our unit tests are held -->
-
-
</appSettings>
</configuration>
@@ -17,14 +17,14 @@ protected void Page_Load(object sender, EventArgs e)
// These values are updated via the .csproj's before build events
_jsResourceFolder = ConfigurationManager.AppSettings["JSResourceFolder"];
_tempFolder = ConfigurationManager.AppSettings["TempFolder"];
- _unitTestFolder = ConfigurationManager.AppSettings["QUnitTestsFolder"];
+ _unitTestFolder = ConfigurationManager.AppSettings["QUnitTestsFolder"];
}
// Make sure nothing is in our dynamic javascript panel
dynamicJavascript.Controls.Clear();
// Load core javascript files to test against
LoadJavascriptFiles(_tempFolder + "/" + _jsResourceFolder);
- // Load unit tests. These unit test the resource javascript files
+ // Load unit tests. These test the resource javascript files
LoadJavascriptFiles(_unitTestFolder);
}
@@ -56,7 +56,7 @@ private void LoadJavascriptFiles(String rootDirectory)
/// <param name="fromPath">Contains the directory that defines the start of the relative path.</param>
/// <param name="toPath">Contains the path that defines the endpoint of the relative path.</param>
/// <returns>The relative path from the start directory to the end path.</returns>
- public static String MakeRelative(String fromPath, String toPath)
+ private static String MakeRelative(String fromPath, String toPath)
{
Uri relativeUri = new Uri(fromPath).MakeRelativeUri(new Uri(toPath));
String relativePath = Uri.UnescapeDataString(relativeUri.ToString());
@@ -8978,5 +8978,4 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {
// Expose jQuery to the global object
window.jQuery = window.$ = jQuery;
-})(window);
-
+})(window);
@@ -21,6 +21,5 @@ $(function () {
$('#messages').append('<li style="background-color:' + color + ';color:white">' + value + '</li>');
}
- status.start({ transport: activeTransport });
-
+ $.connection.hub.start({ transport: activeTransport });
});
@@ -1,139 +0,0 @@
-/// <reference path="chutzpahRunner.js" />
-/*globals phantom, chutzpah, window, jasmine*/
-
-(function () {
- 'use strict';
-
- phantom.injectJs('chutzpahRunner.js');
-
- function onInitialized() {}
-
- function isTestingDone() {
- return window.chutzpah.isTestingFinished === true;
- }
-
- function isJamineLoaded() {
- return window.jasmine;
- }
-
- function onJasmineLoaded() {
- function log(obj) {
- console.log(JSON.stringify(obj));
- }
-
- var activeTestCase = null,
- fileStartTime = null,
- testStartTime = null;
- window.chutzpah.isTestingFinished = false;
- window.chutzpah.testCases = [];
-
- var ChutzpahJasmineReporter = function () {
- var self = this;
-
- self.reportRunnerStarting = function (runner) {
-
- fileStartTime = new Date().getTime();
-
- // Testing began
- log({ type: "FileStart" });
- };
-
- self.reportRunnerResults = function (runner) {
- var res = jasmine.getEnv().currentRunner().results();
- var timetaken = new Date().getTime() - fileStartTime;
- log({ type: "FileDone", timetaken: timetaken, passed: res.passedCount, failed: res.failedCount });
- window.chutzpah.isTestingFinished = true;
- };
-
- self.reportSuiteResults = function (suite) { };
-
- self.reportSpecStarting = function (spec) {
- testStartTime = new Date().getTime();
- var suiteName = getFullSuiteName(spec.suite);
- var specName = spec.description;
- var newTestCase = { moduleName: suiteName, testName: specName, testResults: [] };
- window.chutzpah.testCases.push(newTestCase);
- activeTestCase = newTestCase;
- log({ type: "TestStart", testCase: activeTestCase });
- };
-
- self.reportSpecResults = function (spec) {
- var timetaken = new Date().getTime() - testStartTime;
- activeTestCase.timetaken = timetaken;
- var results = spec.results();
- var resultItems = results.getItems();
- for (var i = 0; i < resultItems.length; i++) {
- var result = resultItems[i];
- var testResult = {};
- testResult.passed = result.passed();
- testResult.message = result.message;
- activeTestCase.testResults.push(testResult);
- }
-
- // Log test case when done. This will get picked up by phantom and streamed to chutzpah.
- log({ type: "TestDone", testCase: activeTestCase });
- };
-
- self.log = function () {
- var console = jasmine.getGlobal().console;
- if (console && console.log) {
- if (console.log.apply) {
- console.log.apply(console, arguments);
- } else {
- console.log(arguments);
- }
- }
- };
-
- self.specFilter = function (spec) {
- return true;
- };
-
- function getFullSuiteName(suite) {
- var description = suite.description;
- if (suite.parentSuite) {
- description = getFullSuiteName(suite.parentSuite) + " " + description;
- }
-
- return description;
- }
-
- return self;
- };
-
- if (window.chutzpah.testMode) {
- jasmine.getEnv().addReporter(new ChutzpahJasmineReporter());
- }
-
- if (window.chutzpah.testMode === 'discovery') {
- // If discovery mode overwrite execute to not run the test
- jasmine.Block.prototype.execute = function (onComplete) {
- onComplete();
- };
- }
- }
-
- function onPageLoaded() {
- var _cachedWindowLoad = window.onload;
- window.onload = function () {
- if (_cachedWindowLoad) {
- _cachedWindowLoad();
- }
-
- var jasmineEnv = jasmine.getEnv();
- var runner = jasmineEnv.currentRunner();
-
- // Check if runner hasn't been executed
- // If so, run it
- if (!runner.queue.running && runner.queue.index <= 0) {
- jasmineEnv.execute();
- }
- };
- }
-
- try {
- chutzpah.runner(onInitialized, onPageLoaded, isJamineLoaded, onJasmineLoaded, isTestingDone);
- } catch (e) {
- phantom.exit(2); // Unkown error
- }
-}());
Binary file not shown.
Binary file not shown.
Oops, something went wrong.

0 comments on commit c926f86

Please sign in to comment.