我正在尝试使用Jasmine和Chutzpah运行TypeScript的基本测试。 这是规格文件
/// <reference path = "../lib/typings/jasmine/jasmine.d.ts"/>
/// <reference path = "../../control/utils.ts"/>
describe('utils', () => {
it('check getCardName', () => {
var data1: any = {}, data2: any = {}, data3: any = {}, data4: any = {};
data1.cardtype = 6;
data2.cardtype = 27;
data3.cardtype = 108;
data4.cardtype = 102;
data4.cardName = "TOP_PEOPLE";
var result1 = MscrmControls.CardFeedContainer.Utils.getCardName(data1);
var result2 = MscrmControls.CardFeedContainer.Utils.getCardName(data2);
var result3 = MscrmControls.CardFeedContainer.Utils.getCardName(data3);
var result4 = MscrmControls.CardFeedContainer.Utils.getCardName(data4);
expect(result1).toBe("RECENTMEETINGs");
expect(result2).toBe("EMAILREMINDER");
expect(result3).toBe("UPCOMING_MEETING");
expect(result4).toBe(data4.cardName);
});
});
这是我的chutzpah.json文件:
{
"Framework": "jasmine",
"Compile": {
"Mode": "External",
"Extensions": [ ".ts" ],
"ExtensionsWithNoOutput": [ ".d.ts" ]
},
"CodeCoverageExcludes": [ "*.spec.ts" ],
"Tests": [
{
"Path": "spec",
"Includes": [ "*/*.spec.ts" ],
"Excludes": [ "*/*.d.ts", "*/**.spec.js" ],
"ExpandReferenceComments": "true"
}
]
}
这是文件夹结构
TestSolution.sln
-control
--utils.ts
-UnitTests
--spec
---utils.spec.js
--chutzpah.json
使用Visual Studio chutzpah测试适配器和运行器运行JS测试时,出现以下错误
Chutzpah错误:System.IO.FileNotFoundException:找不到 生成的路径 E:\ repos ***** \ src ***** \ UnitTests \ spec \ utils.spec.ts 在 e:\ repos ***** \ src ***** \ unittests \ spec \ utils.spec.js 或 E:\ repos ***** \ src ***** \ UnitTests \ spec \ utils.spec.js 文件名: 'e:\ repos ***** \ src ***** \ unittests \ spec \ utils.spec.js' 而 运行:e:\ repos ***** \ src ***** \ unittests \ spec \ utils.spec.js
Chutzpah错误:System.IO.FileNotFoundException:找不到 或以下位置为E:\ repos ***** \ src ***** \ control \ utils.ts生成的路径 E:\ repos ***** \ src ***** \ control \ utils.js
任何帮助将不胜感激。