I am having problems getting Chutzpah to run my typescript tests when I provide a Chutzpah.json file.
my project looks like this:
and my Chutzpah.json file looks like this:
{
"Compile": {
"Mode": "External",
"ExtensionsWithNoOutput": [ ".d.ts" ]
},
"Tests": [
{ "Include": "**/**.ts","Exclude": "**/**.d.ts" }
],
"References": [
{"Include": "../../hacapp.web/**/*.ts", "Exclude": "../../hacapp.web/**/**.d.ts" }
]
}
when I run with this Chutzpah.json file then 0 tests are executed. The output of running the commandline runner with these arguments:
chutzpah.consle.exe /path \hacapp.web\hacapp.web.Tests\Scrpts\TypescriptTests.ts /trace /debug
The contents of the generated html file doesn't seem to contain any reference to the TypescriptTests.js file:
<head>
<meta charset="utf-8" />
<title>QUnit Tests</title>
<link rel="stylesheet" type="text/css" href="file:///C:/Users/sam/Source/Repos/chutzpah-master/ConsoleRunner/bin/Debug/TestFiles/QUnit/qunit.css"/>
<script type="text/javascript" src="file:///C:/Users/sam/Source/Repos/chutzpah-master/ConsoleRunner/bin/Debug/TestFiles/QUnit/qunit.js"></script>
<script type="text/javascript" src="file:///C:/Users/sam/Source/Repos/haccpapp/hacapp.web/hacapp.web/scripts/jquery-1.10.2.js"></script>
<script type="text/javascript" src="file:///C:/Users/sam/Source/Repos/haccpapp/hacapp.web/hacapp.web/scripts/knockout-3.0.0.js"></script>
<script>
var amdTestPath = "";
if (window.require && typeof window.require === "function" && amdTestPath !== "") {
if (window.chutzpah) {
window.chutzpah.usingModuleLoader = true;
}
requirejs.config({
map: {
'*': {
}
}
});
window.QUnit.config.autostart = false;
window.require([amdTestPath], function () {
console.log("!!_!! Starting QUnit from inline AMD call...");
if (!window._Chutzpah_covobj_name) {
window.QUnit.start();
}
});
}
</script>
</head>
If I then rename the Chutzpah.json file so that it is no longer used and then run the command line tool again then this time it runs the tests and this is in the log file, and this is what the html looks like:
<head>
<meta charset="utf-8" />
<title>QUnit Tests</title>
<link rel="stylesheet" type="text/css" href="file:///C:/Users/sam/Source/Repos/chutzpah-master/ConsoleRunner/bin/Debug/TestFiles/QUnit/qunit.css"/>
<script type="text/javascript" src="file:///C:/Users/sam/Source/Repos/chutzpah-master/ConsoleRunner/bin/Debug/TestFiles/QUnit/qunit.js"></script>
<script type="text/javascript" src="file:///C:/Users/sam/Source/Repos/haccpapp/hacapp.web/hacapp.web/scripts/Workflow/_Chutzpah.1.WFDefinition.js"></script>
<script type="text/javascript" src="file:///C:/Users/sam/Source/Repos/haccpapp/hacapp.web/hacapp.web/scripts/jquery-1.10.2.js"></script>
<script type="text/javascript" src="file:///C:/Users/sam/Source/Repos/haccpapp/hacapp.web/hacapp.web/scripts/knockout-3.0.0.js"></script>
<script type="text/javascript" src="file:///C:/Users/sam/Source/Repos/haccpapp/hacapp.web/hacapp.web.Tests/Scripts/_Chutzpah.1.TypescriptTests.js"></script>
<script>
var amdTestPath = "";
if (window.require && typeof window.require === "function" && amdTestPath !== "") {
if (window.chutzpah) {
window.chutzpah.usingModuleLoader = true;
}
requirejs.config({
map: {
'*': {
}
}
});
window.QUnit.config.autostart = false;
window.require([amdTestPath], function () {
console.log("!!_!! Starting QUnit from inline AMD call...");
if (!window._Chutzpah_covobj_name) {
window.QUnit.start();
}
});
}
</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"></div>
</body>
</html>
What am I doing wrong with the configuration?
UPDATED ANSWER
I update the answer based on the full repro given. The original answer is preserved below.
The issue is that by default chutzpah will set the sourcedirectory to look for generated scripts to the location of the chutzpah.json file. Setting it to be a parent of both your source and test folders fixes the issue
ORIGINAL ANSWER
Without having a full repro I cannot confirm if this will solve your problem but I did address a couple issues.
Let me know if that helps.