Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting started with Karma and Jasmine installed - jasmine.Suite() required error

I'm trying to get started with karma and jasmine.

I've installed them both. I believe that Karma can locate my JavaScript files. When I run karma start, my browsers open and state:

Karma v0.12.23 - connected
IE 11.0.0 (Windows 8.1) is idle
Firefox 29.0.0 (Windows 8.1) is idle
Chrome 37.0.2062 (Windows 8.1) is idle

I added a JavaScript file to a location that I thought Karma was monitoring:

it('y should have a length of 1', function () {
    var y = '1';
    expect(y.length).toBe(0);
});

Where would I look to see the unit test fail?

If I open resharper in vs2013, I see the unit test. When I go to run it, a new browser window opens, and it's blank. The console does show on this page:

ncaught Error: jasmine.Suite() required 

How do I get it to pick up my test?

like image 783
Hoppe Avatar asked Sep 26 '14 02:09

Hoppe


Video Answer


1 Answers

As described in the Jasmine nomenclature a suite

Suites: describe Your Tests

A test suite begins with a call to the global Jasmine function describe with two parameters: a string and a function. The string is a name or title for a spec suite – usually what is being tested. The function is a block of code that implements the suite.

So I guess you have to wrap your test in a describe statement

describe('my test suite',function(){
    
    it('my test case',function(){
        //some assertions
    })
});
like image 162
laurent Avatar answered Nov 15 '22 03:11

laurent