mmanela / chutzpah

Chutzpah is an open source JavaScript test runner which enables you to run unit tests using QUnit, Jasmine, Mocha and TypeScript.
http://mmanela.github.io/chutzpah/
Apache License 2.0
550 stars 142 forks source link

Setting "EnableCodeCoverage": "true" causes ArgumentNullException in TFS build #362

Closed Blackbaud-DavidKeegan closed 9 years ago

Blackbaud-DavidKeegan commented 9 years ago

When adding "EnableCodeCoverage": "true", to the chutzpah.json file all tests will fail with the following error:

Error: System.ArgumentNullException: Value cannot be null.
Parameter name: input
   at System.Text.RegularExpressions.Regex.IsMatch(String input)
   at Chutzpah.TestHarness.ChooseRefList(ReferencedFile referencedFile, String referencePath)
   at Chutzpah.TestHarness.BuildTags(IEnumerable`1 referencedFilePaths)
   at Chutzpah.TestHarnessBuilder.CreateTestHarness(TestContext testContext, TestOptions options)
   at Chutzpah.TestRunner.<>c__DisplayClass3.<ExecuteTestContexts>b__2(TestContext testContext)

Without the 'EnableCodeCoverage' line all of the tests will successfully pass.

The full chutzpah.json file is:

{
    "Framework": "jasmine",
    "FrameworkVersion": "2",
    "TestFileTimeout": 600000,
    "CodeCoverageIncludes": [ "*/Presentation/scripts/app/*.js" ],
    "CodeCoverageExcludes": [ "*.spec.js", "*.min.js" ],
    "EnableTestFileBatching": "true",
    "IgnoreResourceLoadingErrors ": "true",
    "TestHarnessLocationMode": "SettingsFileAdjacent",
    "RootReferencePathMode": "SettingsFileDirectory",
    "References": [
        { "Path": "Presentation/scripts/js/jquery/jquery-2.1.1.js" },
        { "Path": "Presentation/scripts/js/bootstrap/bootstrap.js" },
        { "Path": "Presentation/scripts/js/angular/version-1.3.10/angular.js" },
        { "Path": "Presentation/scripts/js/angular/version-1.3.10/angular-mocks.js" },
        { "Path": "Presentation/scripts/js/angular/version-1.3.10/angular-local-storage.js" },
        { "Path": "Presentation/scripts/js/angular/version-1.3.10/angular-ng-grid.js" },
        { "Path": "Presentation/scripts/js/angular/version-1.3.10/angular-resource.js" },
        { "Path": "Presentation/scripts/js/angular/version-1.3.10/angular-animate.js" },
        { "Path": "Presentation/scripts/js/angular/version-1.3.10/angular-busy.js" },
        { "Path": "Presentation/scripts/js/angular/version-1.3.10/angular-ui-router.js" },
        { "Path": "Presentation/scripts/js/angular/version-1.3.10/angular-sanitize.js" },
        { "Path": "Presentation/scripts/js/angular/version-1.3.10/angular-wizard.js" },
        { "Path": "Presentation/scripts/js/angular/version-1.3.10/angulartics.js" },
        { "Path": "Presentation/scripts/js/angular/version-1.3.10/angulartics-ga.js" },
        { "Path": "Presentation/scripts/js/angular/version-1.3.10/angulartics-mixpanel.js" },
        { "Path": "Presentation/scripts/js/angular/version-1.3.10/ui-bootstrap-0.12.0.js" },
        { "Path": "Presentation/scripts/js/angular/version-1.3.10/ui-bootstrap-tpls-0.12.0.js" },
        { "Path": "Presentation/scripts/js/localization/localtext-default.js" },
        { "Path": "Presentation/scripts/js/angular/version-1.3.10/angular-nvd3.js" },
        { "Path": "Presentation/scripts/js/plugins/kendos/kendo.all.js" },
        { "Path": "Presentation/scripts/js/angular/version-1.3.10/angular-kendos.js" },
        { "Path": "Presentation/scripts/jquery.icheck.js" },
        { "Path": "Presentation/scripts/js/responsive-tabs/jquery.responsiveTabs.js" },
        { "Path": "Presentation/scripts/js/plugins/reports/rdEmbed.js" },
        { "Path": "Presentation/scripts/js/plugins/reports/knockout-2.3.0.js" },
        { "Path": "Presentation/scripts/js/plugins/reports/GrapeCity.ActiveReports.Viewer.Html.js" },
        { "Path": "Presentation/scripts/js/angular/version-1.3.10/i18n/angular-locale_en-us.js" },
        { "Path": "Presentation/scripts/js/plugins/kendos/cultures/kendo.culture.en-US.min.js" },
        { "Path": "Presentation/scripts/d3.js" },
        { "Path": "Presentation/scripts/nv.d3.js" },
        { "Path": "Presentation/scripts/toaster.js" },
        { "Path": "Presentation/scripts/lodash.js" },
        { "Path": "Presentation/scripts/moment.js" },
        { "Path": "Presentation/scripts/enquire.js" },
        { "Path": "Presentation/scripts/sky/sky.js" },
        { "Path": "Presentation/scripts/select.js" },
        { "Path": "Presentation/scripts/app", "Include": "*.js", "Exclude": "*.spec.js" }
    ],
    "Tests": [ { "Path": "Presentation/scripts/app/", "Include": "*.spec.js" } ]
}
mmanela commented 9 years ago

Can you provide a full repro? Included all needed file to run your sample.

Blackbaud-DavidKeegan commented 9 years ago

I probably won't be able to provide any repro, since this is likely to be highly dependant on the tfs build environment, and internal code.

As a workaround I have instead set the build to run the command line version of chutzpah to gather coverage information, which is working fine. So Chutzpah runs tests fine through the normal test runner to determine pass/fail, and then re-runs the tests via command line to determine coverage.

If the stack trace is not useful towards isolating any issues, feel free to close this issue.