Getting started with Karma and Jasmine - jasmine.Suite () requires an error

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

I installed them both. I believe Karma can find my JavaScript files. When I start karma start , my browsers open and log:

 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 place that I thought Karma controlled:

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

Where can I see how unit test crashes?

If I open resharper in vs2013, I see unit test. When I go to launch it, a new browser window opens and it is empty. The console is shown on this page:

 ncaught Error: jasmine.Suite() required 

How do I get this test?

+5
source share
1 answer

As described in the Jasmine nomenclature, set

Suites: describe your tests

The test suite begins with a call to the Jasmine global function, which describes two parameters: a string and a function. A string is the name or title for a set of specifications - usually what is being tested. This function is a block of code that implements a package.

So, I think you should wrap your test in describe statement

 describe('my test suite',function(){ it('my test case',function(){ //some assertions }) }); 
+15
source

Source: https://habr.com/ru/post/1203449/


All Articles