Loading Jasmine spec dependencies with TypeScript and Resharper 8.2 test runner

I'm using TypeScript for my project, and would prefer to use TypeScript to write my unit tests as well. I can get everything to run in Chutzpah, with tests that look like so:

///<reference path="../../../Scripts/typings/jasmine/jasmine.d.ts"/>
///<reference path="../../../Scripts/typings/sinon/sinon.d.ts"/>
///<reference path="../../../Scripts/Payboard/Models.ts"/>
///<reference path="../EventReferences.ts"/>

describe('Payboard.Events', () => {

var server: SinonFakeServer;

beforeEach(() => {
    Payboard.Events.setApiKey('apikey');
    server = sinon.fakeServer.create();
});

afterEach(() => {
    server.restore();
});

describe('#getAbsoluteUrl', () => {
    it('should prepend app.payboard.com to the relative url', () => {
        var absoluteUrl = Payboard.Events.getAbsoluteUrl('/some/random/url');
        expect(absoluteUrl).toEqual('//app.payboard.com/some/random/url');
    });
});


So far so good. But you'll notice that I have a dependency on "sinon.js". In Chutzpah, I satisfy that dependency by loading sinon.js in the HTML page that Chutzpah runs:

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Jasmine Spec Runner v2.0.0</title>
    <link rel="shortcut icon" type="image/png" href="../../../Content/jasmine/jasmine_favicon.png">

    <!-- JQuery -->
    <script type="text/javascript" src="../../../Scripts/jquery-2.1.0.js"></script>

    <!-- Jasmine -->
    <link rel="stylesheet" type="text/css" href="../../../Content/jasmine/jasmine.css">
    <script type="text/javascript" src="../../../Scripts/jasmine/jasmine.js"></script>
    <script type="text/javascript" src="../../../Scripts/jasmine/jasmine-html.js"></script>
    <script type="text/javascript" src="../../../Scripts/jasmine/boot.js"></script>

    <!-- Sinon -->
    <script type="text/javascript" src="../../../Scripts/sinon-1.9.0.js"></script>

    <!-- Files to test-->
    <script type="text/javascript" src="../Payboard.js"></script>

    <!-- Tests to run -->
    <script type="text/javascript" src="Events.js"></script>

</head>
<body>
</body>
</html>

I'm told that the way you specify that dependency in Resharper's test runner is to include a reference doc comment, like so:

///<reference path="../../../Scripts/sinon-1.9.0.js">

Unfortunately, TypeScript won't let me put that into my source file. When I try, it gives me the error:

"Incorrect reference. Only files with a .ts extension are allowed."

So . . . any suggestions?

2 comments
Comment actions Permalink

Hi Ken,

please referer to this issue in our tracker: http://youtrack.jetbrains.com/issue/RSRP-389196

Right now workaround is to put sinon.d.js (which should be just a copy of sinon.js) in the same folder where sinon.d.ts is located.

0
Comment actions Permalink

Thanks for the pointer.

0

Please sign in to leave a comment.