Currently, I am in the process of configuring Chutzpah and Jasmine to work together within visual studio. My main objective is to successfully run unit tests with TeamCity integration.
Whenever I save my code, all TypeScript files are compiled into a single .js
file. This triggers Chutzpah to execute my tests, which seems to be functioning correctly thus far.
The problem arises when Chutzpah displays 0 passed, 0 failed, and 0 errors for the test results. Although the Jasmine html file generated correctly lists all of my tests, Chutzpah does not seem to receive any feedback from Jasmine.
A snippet from the trace log reads:
Attempting to create test context for c:\.....\test.ts
Building test context for c:\.....\test.ts
...framework dependencies / other details (~15 lines)
Finished building test context for c:\.....\test.ts
Warning: 0 : Message:Chutzpah detected missing generated .js files, but since the compile mode is External, Chutzpah cannot compile them. Test results may be inaccurate.
Following this, PhantomJS is launched and logs show loading/receiving resources. Surprisingly, my test.ts file is not among the listed resources, while the project-wide .js
file is included (upon inspection, it was evident that my tests were appended to this file).
Completed test run for c:\......\test.ts in Discovery mode
Cleaning up test context for c:\......\test.ts
Chutzpah run completed with 0 pass, 0 fail, and 0 errors
Cleared chutzpah.json file cache
Finished Test Adapter Discover Tests
chutzpah.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);
});
});
I have some suspicions regarding the missing .js files note in the trace log, although it could be related to the single JS compilation step I am using.
Could it be possible that I overlooked referencing Jasmine in my chutzpah.json configuration?
Despite the fact that the Jasmine tests are functioning properly, I am puzzled as to why Chutzpah is not providing any feedback.