Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Anyone have a working Jasmine unittest that runs in Resharper 7 EAP?

I'd really like to be using the R#r test running for my javascript unittests. R#r 7 EAP recognizes the tests but when I launch them the runner shows '... Test wasn't run' for all tests.

I can't find any info on what the R#r test runner expects in terms of configuration/directory structure.

Directory structure and sample test posted here

like image 252
John Dhom Avatar asked May 21 '12 16:05

John Dhom


2 Answers

A basic/hardcoded jasmin unit test does work under R#r 7 EAP. This implies that jasmine is baked in to R#r i guess. Have an open question regarding same.

describe('resharper jasmine testrunner', function () {
    describe('simplest possible test', function () {
        it('should execute', function() {
            expect(true).toBe(true);
        });
    });
});

Got a pointer on the R#r forum that doc comment references are your 'includes' (or jsTestDriver.conf equiv).

/// <reference path="../../libs/testing/jasmine/jasmine.js"/>
/// <reference path="../../libs/crunch/jquery-1.6.2.js"/>

Have yet to get my real tests passing though the now run. Investigating fixture paths next.

like image 119
John Dhom Avatar answered Oct 05 '22 23:10

John Dhom


I'm not sure how advanced of a solution/structure you're looking for, as I just started looking into this myself, but i have a simple example test "working"*... (using Resharper 7 EAP 7.0.56.103). As far as i know, you can structure your test files anyway/where you want, as long as you include references to all of its dependencies with <reference path="foo/path/file.js" />)

*These pass inside the ReSharper unit tests session window. The browser does not show me any sort of test info but rather a blank screen with some jasmine-related html in the source.

/scripts/cheese.js

function Cheese() {
    return {
        isGood: true
    };
}

/tests/cheeseTest.js

/// <reference path="/scripts/cheese.js"/>
describe('simplest possible test', function() {
    var cheese = null;
    it('cheese is good', function() {
        cheese = new Cheese();
        expect(cheese.isGood).toBe(true);
    });
});
like image 44
brianc Avatar answered Oct 06 '22 01:10

brianc