I have a TypeScript project that uses Visual Studio's "Combine JavaScript output into file" option to create a single .js
file containing all my application's code (excluding libraries). I'm using the Chutzpah Test Adapter to integrate and run Jasmine unit tests. If I run a code coverage analysis with no tests, the tool reports I have 23% test coverage:
What is causing this inflated statistic?
My current theory is that when Chutzpah runs my code (app.js
) in order to define all of the classes to be used in the tests, blanket.js (which is what Chutzpah uses under the hood to get code coverage statistics) sees that these lines are being run and counts them as a "covered line".
Is there a way to only include lines that are hit during a test (as opposed to before the test, for setup purposes) towards the final code coverage statistic? Or is this inflated number caused by something else?
Here's my chutzpah.json
:
{
"Compile": {
"Extensions": [ ".ts" ],
"ExtensionsWithNoOutput": [ ".d.ts" ],
"Mode": "External"
},
"References": [
{ "Path": "initialize.js" },
{ "Path": "./MyApp/lib/jquery-1.11.2.min.js" },
{ "Path": "./MyApp/lib/jquery-ui.min.js" },
{ "Path": "./MyApp/lib/knockout-3.3.0.js" },
/* other references here.... */
{ "Path": "./MyApp/app.js" }
],
"Tests": [
{ "Includes": [ "**/*.ts" ], "Excludes": [ "**/*.d.ts" ] }
],
"CodeCoverageIncludes": [ "*app.js*" ],
"TestFileTimeout": 100000
}