使用茉莉/放肆與AMD合作,我不能得到打字稿的測試在VS。打字稿 - 茉莉 - 放肆 - AMD - 的Visual Studio 2012
Sample.ts:
export class Sample {
constructor(public name: string) { }
}
Simple.ts:
/// <reference path="./require.d.ts" />
/// <reference path="./jasmine.d.ts" />
import SampleModule = module("./Sample");
describe("TypeScript1", function() {
it("should pass a simple test", function() {
expect(1).toEqual(1);
});
});
describe("TypeScript2", function() {
it("should pass a sample test", function() {
var sample = new SampleModule.Sample("Wow");
expect(sample.name).toEqual("Wow");
});
});
...這會導致:
測試名稱:TypeScript1應該通過一個簡單的測試 測試結果:通過
測試名稱:TypeScript2應通過樣本測試 測試結果:失敗 測試時間:0:00:00
結果消息:的ReferenceError:找不到變量:SampleModule文件:typescripthtmlapp1/_Chutzpah.28.simple.js(9號線)
添加:
/// <reference path="./Sample.ts" />
...導致未檢測到測試。
我錯過了什麼?
你的意思 「chutzpah_reference」 是什麼?我遇到同樣的問題嘗試使用chutzpah插件運行Qunit測試。 看到http://stackoverflow.com/questions/16464984/how-to-load-a-public-function-using-qunit-and-typescript – Rolando 2013-05-09 22:08:42
Chutzpath的作者加入了「chutzpah_reference」標籤的處理指定的JavaScript運行測試時需要包含的文件 - 請參閱我的答案中的'here'所引用的鏈接。 – MiMo 2013-05-10 08:34:36
謝謝你的回答:) – Rolando 2013-05-10 13:32:35