How do I focus on one spec in jasmine.js?

Solution 1:

When using Karma, you can enable only one test with fit or fdescribe (iit and ddescribe in Jasmine before 2.1).


This only runs Spec1:

// or "ddescribe" in Jasmine prior 2.1
fdescribe('Spec1', function () {
    it('should do something', function () {
        // ...
    });
});

describe('Spec2', function () {
    it('should do something', function () {
        // ...
    });
});

This only runs testA:

describe('Spec1', function () {

    // or "iit" in Jasmine prior 2.1
    fit('testA', function () {
        // ...
    });

    it('testB', function () {
        // ...
    });

});

Solution 2:

In core since 2.1 with fit and fdescribe.