我试图让Chutzpah和Jasmine一起在visual中工作,我的最终目标是让单元测试与TeamCity集成一起运行。
在保存时,所有类型记录代码都生成一个.js文件。这也会导致Chutzpah运行我的测试,到目前为止还不错。
我的问题是Chutzpah报告0通过,0失败和0错误。生成的Jasmine文件正确地列出了我的所有测试,但是Chutzpa似乎没有收到任何来自Jasmine的信息。
跟踪日志的突出显示:
Trying to build test context for c:\.....\test.ts
Building test context for c:\.....\test.ts
...framework dependencies / other ok looking things... (~15 lines)
Finished building test context for c:\.....\test.ts
Warning: 0 : Message:Chutzpah determined generated .js files are missing but the compile
mode is External so Chutzpah can't compile them. Test results may be wrong.然后启动Phantom js并记录加载/接收资源。我的test.ts文件不是列出的资源之一,但是站点范围的.js是(我检查了站点范围的文件,我的测试被附加到它)。
Finished test run for c:\......\test.ts in Discovery mode
Cleaning up test context for c:\......\test.ts
Chutzpah run finished with 0 passed, 0 failed and 0 errors
Chutzpah.json file cache cleared
End Test Adapter Discover Testschutzpah.json
{
"Framework": "jasmine",
"EnableTestFileBatching": true,
"Compile": {
"Mode": "External",
"Extensions": [ ".ts" ],
"ExtensionsWithNoOutput": [ ".d.ts" ],
"Paths": [
{
"OutputPath": "../SiteWide.js",
"SourcePath": "Views"
}
]
},
"References": [
{
"Path": "../knockout-3.4.2.js",
"IsTestFrameworkFile": true
}
],
"Tests": [
{
"Includes": [ "*.ts" ],
"Path": "../Tests/Views"
}
],
"EnableTracing": true,
"TraceFilePath": "./trace.log"
}tests.ts
describe('configuring unit tests for typescript!', () => {
it('this should pass', () => {
expect(1).toBe(1);
});
it('this should fail', () => {
expect(1).toBe(0);
});
});有几件事我很怀疑(跟踪中缺少的.js文件行--但这可能只是由我的单个js文件编译步骤引起的?)
也许我在chutzpah.json里漏掉了茉莉花的参考资料?
我不明白为什么茉莉花测试有效,但Chutzpah不报告。
发布于 2018-05-07 16:08:42
也许晚了..。但是在chutzpah.json中这样的东西会有帮助。
{
"Framework": "jasmine",
"Compile": {
"Mode": "External",
"Extensions": [ "*.ts" ],
"ExtensionsWithNoOutput": [ "*.d.ts" ]
},
"References": [
{ "Path": "node_modules/promise-polyfill/dist", "Include": "*.js", "Exclude": "*.d.ts" },
{ "Path": "node_modules/systemjs/dist", "Include": "*.js", "Exclude": "*.d.ts" }
],
"Tests": [
{ "Path": "unittests", "Includes": [ "*.spec.ts" ], "Excludes": [ "*.d.ts" ], "ExpandReferenceComments": "true" }
]}
在引用中,拥有与系统相关的文件非常重要。您也可以在测试部分中尝试"*.spec.js“。
https://stackoverflow.com/questions/49524099
复制相似问题