I've installed the 2 Chutzpah Visual Studio add-ins (using VS 2015), the Context Menu and Test Explorer extensions. I can right click the test.js file and it runs successfully. I can run the test from Test Explorer and the test runs successfully. The problem is when I right click the test.html file, I get the following errors.
Error: Error: Called start() while test already started running at start in file:///C:/Users/byron/documents/visual%20studio%202015/Projects/WebApplication1/WebApplication1/Tests/Framework/qunit-2.3.2.js (line 2679) at startQUnit (line 12) at onPageLoaded (line 16) (line 18) While Running:C:\Users\byron\documents\visual studio 2015\Projects\WebApplication1\WebApplication1\Tests\codeSample\test.html ------ Test started: File: C:\Users\byron\documents\visual studio 2015\Projects\WebApplication1\WebApplication1\Tests\codeSample\test.html ------ Error: TypeError: undefined is not an object (evaluating 'QUnit.jsDump.multiline = false') at log in undefined (line 88) at runLoggingCallbacks in file:///C:/Users/byron/documents/visual%20studio%202015/Projects/WebApplication1/WebApplication1/Tests/Framework/qunit-2.3.2.js (line 1036) at logAssertion in file:///C:/Users/byron/documents/visual%20studio%202015/Projects/WebApplication1/WebApplication1/Tests/Framework/qunit-2.3.2.js (line 1701) at pushResult in file:///C:/Users/byron/documents/visual%20studio%202015/Projects/WebApplication1/WebApplication1/Tests/Framework/qunit-2.3.2.js (line 1672) at pushFailure in file:///C:/Users/byron/documents/visual%20studio%202015/Projects/WebApplication1/WebApplication1/Tests/Framework/qunit-2.3.2.js (line 1685) at run in file:///C:/Users/byron/documents/visual%20studio%202015/Projects/WebApplication1/WebApplication1/Tests/Framework/qunit-2.3.2.js (line 1430) in file:///C:/Users/byron/documents/visual%20studio%202015/Projects/WebApplication1/WebApplication1/Tests/Framework/qunit-2.3.2.js (line 1620) at advance in file:///C:/Users/byron/documents/visual%20studio%202015/Projects/WebApplication1/WebApplication1/Tests/Framework/qunit-2.3.2.js (line 1105) at begin in file:///C:/Users/byron/documents/visual%20studio%202015/Projects/WebApplication1/WebApplication1/Tests/Framework/qunit-2.3.2.js (line 2796) in file:///C:/Users/byron/documents/visual%20studio%202015/Projects/WebApplication1/WebApplication1/Tests/Framework/qunit-2.3.2.js (line 2756) While Running:C:\Users\byron\documents\visual studio 2015\Projects\WebApplication1\WebApplication1\Tests\codeSample\test.html Error: TypeError: undefined is not an object (evaluating 'QUnit.jsDump.multiline = false') at log in undefined (line 88) at runLoggingCallbacks in file:///C:/Users/byron/documents/visual%20studio%202015/Projects/WebApplication1/WebApplication1/Tests/Framework/qunit-2.3.2.js (line 1036) at logAssertion in file:///C:/Users/byron/documents/visual%20studio%202015/Projects/WebApplication1/WebApplication1/Tests/Framework/qunit-2.3.2.js (line 1701) at pushResult in file:///C:/Users/byron/documents/visual%20studio%202015/Projects/WebApplication1/WebApplication1/Tests/Framework/qunit-2.3.2.js (line 1672) at pushFailure in file:///C:/Users/byron/documents/visual%20studio%202015/Projects/WebApplication1/WebApplication1/Tests/Framework/qunit-2.3.2.js (line 1685) at pushFailure in file:///C:/Users/byron/documents/visual%20studio%202015/Projects/WebApplication1/WebApplication1/Tests/Framework/qunit-2.3.2.js (line 1822) at onError in file:///C:/Users/byron/documents/visual%20studio%202015/Projects/WebApplication1/WebApplication1/Tests/Framework/qunit-2.3.2.js (line 2560) at onerror in file:///C:/Users/byron/documents/visual%20studio%202015/Projects/WebApplication1/WebApplication1/Tests/Framework/qunit-2.3.2.js (line 3844) While Running:C:\Users\byron\documents\visual studio 2015\Projects\WebApplication1\WebApplication1\Tests\codeSample\test.html Error: Timeout occurred when executing test file While Running:C:\Users\byron\documents\visual studio 2015\Projects\WebApplication1\WebApplication1\Tests\codeSample\test.html ========== Total Tests: 0 passed, 0 failed, 0 total ==========
I have used the Chutzpah sample files for testing with the addition of a test to test JQuery is working, here are the files and Chutzpah.json file.
test.html
<html>
<head>
<link rel="stylesheet" href="../Framework/qunit-2.3.2.css" type="text/css" />
<script type="text/javascript" src="../Framework/jquery-3.1.1.js"></script>
<script type="text/javascript" src="../Framework/qunit-2.3.2.js"></script>
<script type="text/javascript" src="code.js"></script>
<script type="text/javascript" src="test.js"></script>
</head>
<body>
<h1 id="qunit-header">Unit Tests</h1>
<h2 id="qunit-banner"></h2>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests">
</ol>
<div id="qunit-fixture">test markup, will be hidden</div>
</body>
</html>
test.js
/// <reference path="code.js"/>
QUnit.module("test");
$(document).ready(function() {
QUnit.test("will add 5 to number",
function() {
var res = mathLib.add5(10);
QUnit.assert.equal(res, 15, "should add 5");
});
QUnit.test("test jquery",
function() {
var result = $("#qunit-fixture");
QUnit.assert.ok(result.length > 0);
});
});
code.js
var mathLib = {
add5: function (a) {
return a + 5;
}
}
Chutzpah.json
{
"RootReferencePathMode": "SettingsFileDirectory",
"References": [
{ "Path": "Framework" }
]
}
My project folder structure:
- WebApplication1 (Project)
- Boiler Plate MVC Folders
- Tests
- codeSample
- code.js
- test.html
- test.js
- Framework
- jquery-3.1.1.js
- qunit-2.3.2.css
- qunit-2.3.2.js
Ultimately, I need to update 250 JS tests to run all of them from Visual Studio. Currently, all the tests only run in TeamCity via a script.