Qunit Support and problems with Reference Path


I have a project that is already using QUnit. It works and runs just fine like that with a normal web page.

However I'd like to use the built in support for this.


The Reference Paths are all set up (mostly for general JavaScript Resharper support), and some are nested, however no file of mine has any issues come up from resharper. However, when I let reSharper run the tests, it doesn't load them all. Maybe 1 reference.

I can provide a very stripped down example tonight, or link to the current solution I am trying this with on Bitbucket but here is what it looks like basically, so far.

An example:


In A Folder called Accounts we have a file LoginTests.js


/// <reference path="../qunit.js"/>
/// <reference path="eAccountContents.Login.js"/>

Then in eAccountContents.Login.js:

/// <reference path="../JavaScript/eJavaScriptContents.Form.js"/>
/// <reference path="eAccountContents.Hub.js"/>

Then in eAccountContents.Hub is nothing of interest however in eJavaScriptContents.Form.js:

/// <reference path="eJavaScriptContents.JQuery.js"/>
/// <reference path="eJavaScriptContents.JQueryValidation.js"/>

Which are both just the cut/paste contents of the most recent jQuery and jQueryValidation.
The Tests run fine on a page with them all in this order:

<script type="text/javascript" src="@Url.Content("~/Scripts/qunit.js")"> </script>
<script type="text/javascript" src="@Url.Content("~/Scripts/JavaScript/eJavaScriptContents.JQuery.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/JavaScript/eJavaScriptContents.JQueryValidation.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/JavaScript/eJavaScriptContents.SignalR.js")"></script>
<script type="text/javascript" src="@Url.Content("~/signalr/hubs")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/JavaScript/eJavaScriptContents.Form.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/Accounts/eAccountContents.Hub.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/JavaScript/eJavaScriptContents.Hub.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/Accounts/eAccountContents.Login.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/Accounts/eAccountContents.Login.Tests.js")"></script>

I know the SignalR stuff won't work, but I had this issue before I added SignalR. I'd be fine with it forcing me to factor it out :)

This is on a machine with:
Visual Studio 2010 SP1
Resharper 6
dotCover 1.1.1
dotTrace 4.5.1 Performance

Comment actions Permalink

ReSharper's test runner doesn't support nested references yet. I've created a request for this: http://youtrack.jetbrains.net/issue/RSRP-277193

As for now, you could reference all dependent files from your test file.

Comment actions Permalink

Actually that isn't the main issue.

The runner actually won't find files in another directory. Knowing that it should work without the nesting,however, did get me on the right track.

The directory structure was like this:

/Scripts/Accounts/Test File
/Scripts/Accounts/Main Referenced File
/Scripts/JavaScript/More Referenced Files

Having them all in the same directory will be annoying, but having it work in and of itself will be pretty nice.

Comment actions Permalink

Issue with referenced files from another directory is fixed in ReSharper 6.1, EAP for this version will start soon.


Please sign in to leave a comment.