I've been experimenting with adding Chutzpah to our TFS 2012 build server. Initially everything looked promising but I encountered a ReferenceError issue as soon as I got beyond the initial use case.
It sounds similar to
but whereas they're home and dry I am unfortunately not :-(
The error I encountered was this: (names changed)
ReferenceError: Can't find variable: xyz in file:///C:/Builds/1/ [...] /xyzTests.js (line 13)
The xyz variable is defined in xyzViewModel.js and it is referenced in the test file like this:
/// <reference path="../../../../../Scripts/jasmine.js" chutzpah-exclude="true" />
/// <reference path="../../../../../Scripts/Areas/Views/xyz/xyzViewModel.js" />
xyzTests.js was given a BuildAction of
and a Copy to Output Directory of
xyzViewModel.js was given a BuildAction of
and I changed the Copy to Output Directory to
to try and rectify the problem. Unfortunately it didn't fix the issue.
I'm a little stuck now and wondering if I'm missing something.... Any thoughts anyone?
I'm using Chutzpah 3.1, I was following the instructions in the blog post on
and the version of Chutzpah used on the build server was taken from the
latest VSIX / zip
I appear to have solved my problem. Step 7 of the blog post I was following says:
Make sure that the js files (that contain the tests) are getting copied to the build output directory.
This appears to suggest that test files should be set to "Copy always". Setting this to actually be "Do not copy" fixed my problem and I was able to confirm that tests were run as expected.
So that's good news and I'm left with 2 small questions if anyone could pitch in:
- I'm presuming that Chutzpah must have changed since that blog post was written so the "Copy always" step is no longer required. Is there any detail available on that?
- At present I have a "tests" folder in the root of my web app which duplicates the folder structure of the "scripts" folder and contains any test files appropriately nested. The downside of this is that the tests get pushed out when I
hit "publish" which is not really what I want. Is there a straightforward way to prevent this?