0

I am writing unit tests for an angularjs application using jasmine with the test runner being chutzpah. All code for this application is written with typescript and the chutzpah.json file is configured to compile the .ts files properly. The editor I am using is Visual Studio 2012 Premium with the chutzpah test adapter & context menu extensions of course. The images below demonstrate how the same test is showing up multiple times:

I added multiple screenshots because the source for each screenshot is different for each reference to the test.

One thing to note is that the test is written in a file named configurationServiceSpec.ts for an angular service called ConfigurationService and is injected into other components throughout the application.

angular.module('ConfigurationService', []);

While each test in the list has a status of Passed in Test Explorer, I am finding that when the tests are run during a TFS build operation, 4 of the 5 "copies" of the test pass while 1 fails. Any insights would be very much appreciated. Thanks

enter image description here enter image description here enter image description here enter image description here enter image description here

gyochum
  • 131
  • 4
  • 12

1 Answers1

0

Your chutzpah.json is wrong. The below updated one should work correctly. Since you have a compile configuration set you don't need to reference the .js files, instead you should reference the .ts files and let Chutzpah find the matching .js ones.

{ "Compile": { "Mode": "External", "Extensions": [".ts"], "ExtensionsWithNoOutput": [".d.ts"]
}, "References": [ { "Path": "../Scripts/jquery-1.11.0.js" }, { "Path": "../Scripts/angular.js" }, { "Path": "../Scripts/angular-route.js" }, { "Path": "../Scripts/angular-mocks.js" }, { "Path": "../Scripts/angular-animate.js" }, { "Path": "../Scripts/angular-cookies.js" }, { "Path": "../Scripts/angular-resource.js" }, { "Path": "../Scripts/angular-sanitize.js" }, { "Path": "../Scripts/angular-ui.min.js" }, { "Path": "../Scripts/angular-ui/ui-bootstrap.js" }, { "Path": "../Scripts/typings/_allReferences.js" }, { "Path": "service", "Include": "*.ts" }, { "Path": "app.ts" } ], "Tests": [ { "Path": "module1", "Include": "*Spec*.ts" }, { "Path": "service", "Include": "*Spec*.ts" } ]
}

Matthew Manela
  • 16,572
  • 3
  • 64
  • 66