Search code examples
unit-testingvisual-studio-2013nunittypescriptchutzpah

Code Coverage with chutzpah resulting in timeout error


I am using Chutzpah Version 3.2.3 with Typescript and nUnit.

I am able to successfully run the unit tests. But when i do cod coverage for the same unit tests i get

Error: Timeout occurred when executing test file

I have no clue where to even start looking to fix it. I have been banging my head about this issue for a day now, Any leads are highly appreciated.

Below is my chutzpah.json

{
"Framework": "qunit",
"TestHarnessLocationMode": "Custom",
"TestHarnessDirectory": "../example.exampleTest.Client.Excel.Web/App",

"Compile": {
    "Mode": "External",
    "Extensions": [ ".ts" ],
    "ExtensionsWithNoOutput": [ ".d.ts" ],
    "SourceDirectory": "../../Example.exampleTest/",
    "OutDirectory": "../../Example.exampleTest/"
}

}


Solution

  • I was able to resolve the issue by being specific about which files to include in code coverage and which files to exclude. Below is my updated chutzpah.json

    {
    "Framework": "qunit",
    "EnableCodeCoverage ": "true",
    "CodeCoverageIncludes": [
        "*Orchestrator*",
        "*Transformer*",
        "*Processor*"
    ],
    "CodeCoverageExcludes": [
        "*\\Example.Example.Client.Excel.Web\\App\\Workstreams\\AX-AX\\*",
        "*\\Example.Example.Client.Excel.Web\\App\\Workstreams\\CS\\v1.0\\CS-ICS\\*",
        "*\\Example.Example.Client.Excel.Web\\App\\Workstreams\\CAD-CAD\\*",
        "*\\Example.Example.Client.Excel.Web\\App\\AddInModules\\*",
        "*\\Example.Example.Client.Excel.Web\\Scripts\\*",
        "*\\Example.Example.Client.Excel.Web\\Mocks\\*"
    ],
    
    "TestFileTimeout":"200000", 
    "Compile": {
        "Mode": "External",
        "Extensions": [ ".ts" ],
        "ExtensionsWithNoOutput": [ ".d.ts" ],
        "SourceDirectory": "../../Example.Example/",
        "OutDirectory": "../../Example.Example/"
    }
    }