I'm really new to Churtzpah and Jasmine. I have been trying to run tests using Chutzpah. I'm using Jasmine, Typescript , Chutzpah , angular2 to write unit tests. Whenever i try to run the tests , I see that my tests are being detected . My chutzpah.json file is as follows :
{
"Framework": "jasmine",
"Compile": {
"Mode": "Executable",
"Executable": "../compile.bat",
"Extensions": [ ".ts" ],
"ExtensionsWithNoOutput": [ ".d.ts" ],
"UseSourceMaps": true,
"Paths": [
{
"SourcePath": "../",
"OutputPath": "../"
}
]
},
"References": [
{ "Path": "../node_modules/es6-shim/es6-shim.js" },
{ "Path": "../node_modules/reflect-metadata/Reflect.js" },
{ "Path": "../node_modules/systemjs/dist/system.src.js" },
{ "Path": "../node_modules/zone.js/dist/zone.js" },
{ "Path": "../node_modules/zone.js/dist/jasmine-patch.js" },
{ "Path": "../node_modules/zone.js/dist/async-test.js" },
{ "Path": "../node_modules/zone.js/dist/fake-async-test.js" },
{ "Path": "../node_modules/core-js/client/shim.min.js" },
{
"Path": "app",
"Includes": [ "*.ts" ],
"Excludes": [ "*.d.ts" ]
}
],
"Tests": [
{ "Include": "*.spec.ts" }
]
}
import {it, describe, beforeEach, inject, beforeEachProviders} from "@angular/core/testing";
import {LoginService} from "./login.service";
describe("testing LoginService", () => {
let Myservice: LoginService = new LoginService();
it("Should return true", () => {
expect(Myservice.validateUser("test", "test")).toBe(true);
});
it("validateUser should fail if input values are null", () => {
expect(Myservice.validateUser(null, null)).toBe(false);
});
});
Let me know what else I need to do. thanks
the compile.bat looks like
@echo off tsc.cmd app/login/login.service.ts app/tests/login.service.spec.ts --sourcemap--declaration
I see the following error in the test output window
Error: ReferenceError: Can't find variable: require
at global code in file:"path"
0 passed, 0 failed, 0 total (chutzpah).
========== Total Tests: 0 passed, 0 failed, 0 total ==========