Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mark a Jasmine test as skipped while using the Karma-Jasmine provider in Karma-Runner?

I have this jasmine test that I'm running with Karma:

describe('When a logged in user chooses Rent and Payment PIN is enabled', function() {
    beforeEach(function(){

    });

    afterEach(function() {

    });

    it('should be presented with a dialog to enter the pin', function() {
       //test to be skipped
    })
})    

And I want to see on report that this test has been skipped and come back to test when all stuff needed for test will be ready.

How can I accomplish this?

like image 586
MarJano Avatar asked Jul 18 '13 13:07

MarJano


People also ask

How do you skip a jasmine test?

Excluding Tests / Specs If you want to exclude a specific test, simply use xit() instead of it() . The x means exclude. describe('description', function () { xit('description', function () {}); }); If you want to exclude an entire describe block, use xdescribe() instead of describe() .

Does Jasmine need karma?

Jasmine is a behavior-driven development framework for testing JavaScript code that plays very well with Karma. Similar to Karma, it's also the recommended testing framework within the Angular documentation as it's setup for you with the Angular CLI. Jasmine is also dependency free and doesn't require a DOM.

Which Jasmine function can be used to define a suite of tests?

Specs. A spec declares a test case that belongs to a test suite. This is done by calling the Jasmine global function it() which takes two parameters, the title of the spec (which describes the logic we want to test) and a function that implements the actual test case.


1 Answers

You might try using the pending function in your spec. According to the doc, pending specs don't run, but names still show up in the results. For 2.0, it also says an empty method body should work. Try:

it('should be presented with a dialog to enter the pin', function() {
   pending();
})

or

it('should be presented with a dialog to enter the pin');
like image 129
ossek Avatar answered Jan 03 '23 11:01

ossek