I am trying to figure out how typescript-jasmine-chutzpah combination will finally test my typescript code. So I have a sample project (shown in the picture).
I have an app.ts file with the following content
class Calculator {
add = function(x:number, y:number) {
return x + y;
}
}
and the test file appTest.ts
/// <reference path="../typings/jasmine/jasmine.d.ts" />
/// <reference path="../../app.ts" />
/// <chutzpah_reference path="../jasmine/jasmine.js" />
/// <chutzpah_reference path="../../app.js" />
describe("Test Calc", function () {
it("add function", function () {
var calc = new Calculator(),
res = calc.add(4, 7);
expect(res).toBe(11);
});
});
If I run tests on testApp.ts the output will be "0 passed, 0 failed, 0 total (chutzpah)." but if I run the compiled testApp.js it seems to work fine "1 passed, 0 failed, 1 total (chutzpah)."
1) Why the tests in .ts file are not found? 2) Should I test my typescript code writing code in Typescript or directly with JavaScript?
Can someone help me figure out this simple test set up and make it work? Notice that I don't use chutzpah.json at the moment.