Chutzpah configuration for running TypeScript tests in both Visual Studio and Visual Studio Team Services

We have a Visual Studio 2013 solution for an AngularJS application written in TypeScript. There is a separate test project for Jasmine unit tests, also written in TypeScript.

We are having problems finding the assembly configuration / Chutzpah, which allows us to run tests on development machines through the Chutzpah test adapter, as well as within our CI assembly on Visual Studio Team Services.

When we run tests on dev machines, it seems that by default the tests run in the source tree, so the dependencies on the .d.ts files and .ts applications are installed relative to the source directory. So far, so good. However, when we run the Visual Studio Team Services build (creating the next blog post ), the tests seem to run in the bin directory (see Visual Studio Team Services logs). This means that dependency links are incorrect, so the tests fail because they cannot find the required .d.ts files or .ts applications.

The best solution for this we have found so far is the following:

  • Chutzpah.json has the option "Always copy", so it copies to bin dir
  • All .ts test files are installed on TypeScriptCompile / Copy always
  • All test .d.ts files are always installed in Content / Copy (e.g. jasmine.d.ts)
  • All .ts files in the application project are set to TypeScriptCompile / Copy always
  • Updating the dependencies of the test file to include additional chutzpah_reference, which will be correct for bin dir (using chutzpah_reference means that the local VS build will still complete without errors)

Then we can run the tests in VS in two ways:

  • from the test runner VS as usual
  • showing all the files, find the bin / Tests directory and right-click and Run JS Tests (this is a pretty good indicator that the tests will work correctly on TFS, assuming def, CI and .runsettings are configured correctly).

JS bin, VS, VS Team Services - .js.

:

  • .ts
  • bin dir.
  • Chutzpah External ( VS TypeScript)
+4
1

, , . TypeScript Team Services. , TypeScript Team Services. TypeScript JavaScript, , Visual Studio Build . , , TypeScript, TypeScript csproj. . Team Services JavaScript.

, , . , 2 , Chutzpah - Chutzpah. ( ) . Chutzpah PhantomJS . Team Services. . , . , Chutzpah NuGet. NuGet , , PhantomJS, QUnit, Jasmine . , . . chutzpah.json. (, qunit ..) , . , , , jQuery Angular. , , . Team Services.

, . JavaScript. .NET, , , . : , VS Test Path to custom Test. :

  • : **\*. tests.js

, .tests.js, .

  1. VS Test version: Latest

Team Services .

  1. : $(Build.SourcesDirectory)\packages

, NuGet. Chutzpah Test .

, , , .

+3

All Articles