Getting set up to run JS unit tests locally (via Visual Studio with Resharper):
- Download and install PhantomJS http://phantomjs.org/download.html
- Stick the contents of the zip somewhere
- You can now right-click and run unit tests as you would for C# ones.
chutzpah.json configures running the tests on TeamCity and code coverage reporting. Any libraries (e.g. JQuery) you reference should be excluded from code coverage. All the test files in the tests project should also be excluded (the configured wildcard should be enough to do this).
Tests are run via Chutzpah, this is configured as a nuget package for the solution and should be pulled down automatically.
Command line build step, Executable with parameters:
Test results show up in the normal way under the Tests tab. Code coverage report Under general settings add an artifact path for _Chutzpah.coverage.html – this will then show up under the build page as a tab called “JS Code Coverage”