Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do I run a single test from the command line using jasmine 2.0

As the title says, I would like to run a single test, not the whole spec. The naive way I tried was using a case like this:

describe("MyCase",function() {
    it("has a test",function() {
        expect(something).toBe(something);
    }

    it("has another test",function() {
        expect(something_else).toBe(something_else);
    }
}

This is saved in a file called MyCase.spec.js (if this matters). I would have thought that it would be possible to run just the first case using the following from the command line:

jasmine-node --match="MyCase has a test"

But this is apperantly not the way to do it. So how is it done?

Thanks!

like image 253
Mikael Lindqvist Avatar asked Dec 19 '22 10:12

Mikael Lindqvist


1 Answers

it may be pretty old channel but it would help someone who is looking for running specific testcase with jasmine 2.0. Use "fdescribe" to run a specific suite and use "fit" to run a specific spec.This skips all other tests except marked.

keep an eye and not to commit fdescribe and fit to repo. Here f describe the "focus".

For lower versions we can use ddescribe, iit as described in upper answers.

like image 90
Pradeep Potnuru Avatar answered Jan 08 '23 11:01

Pradeep Potnuru