当我提供一个Chutzpah.json文件时,我很难让Chutzpah运行我的类型记录测试。
我的项目如下:

我的Chutzpah.json文件如下所示:
{
"Compile": {
"Mode": "External",
"ExtensionsWithNoOutput": [ ".d.ts" ]
},
"Tests": [
{ "Include": "**/**.ts","Exclude": "**/**.d.ts" }
],
"References": [
{"Include": "../../hacapp.web/**/*.ts", "Exclude": "../../hacapp.web/**/**.d.ts" }
]
}当我使用这个Chutzpah.json文件运行时,将执行0次测试。使用以下参数运行命令行运行程序的输出:
\hacapp.web\hacapp.web.Tests\Scrpts\TypescriptTests.ts chutzpah.consle.exe /path /trace /debug
就在这里
生成的html文件的内容似乎不包含对TypescriptTests.js文件的任何引用:
<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> 如果我将Chutzpah.json文件重命名为不再使用它,然后再次运行命令行工具,那么这一次它将运行测试和这在日志文件中。,这就是html的样子:
<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>我的配置有什么问题?
发布于 2014-11-04 00:47:56
更新应答
我根据所给出的全文更新答案。原来的答案保留在下面。
问题是,在默认情况下,chutzpah将设置Source目录以查找生成的脚本到chutzpah.json文件的位置。将其设置为源文件夹和测试文件夹的父级,可以解决此问题。
{
"Compile": {
"Mode": "External",
"Extensions": [ ".ts" ],
"ExtensionsWithNoOutput": [ ".d.ts" ],
"SourceDirectory": "../../",
"OutDirectory": "../../"
},
"Tests": [
{ "Include": "*/*.ts","Exclude": "*/*.d.ts" }
],
"References": [
{"Include": "../../ChutzpaWeb/*/*.ts", "Exclude": "../../ChutzpaWeb/*/*.d.ts" }
]
}原始答案
如果没有完整的复制,我无法确认这是否能解决您的问题,但我确实解决了几个问题。
{
"Compile": {
"Mode": "External",
"Extensions": [ ".ts" ],
"ExtensionsWithNoOutput": [ ".d.ts" ]
},
"Tests": [
{ "Include": "*/*.ts","Exclude": "*/*.d.ts" }
],
"References": [
{"Include": "../../hacapp.web/*/*.ts", "Exclude": "../../hacapp.web/*/*.d.ts" }
]
}如果这有帮助的话请告诉我。
https://stackoverflow.com/questions/26724360
复制相似问题