Vickar
Vickar

Reputation: 953

how do I log the specs when the tests are successful in Jasmine?

As, mocha logs the specs string if the test is successful. for the below test suite,

describe("capitalize", function() {
   it("capitalizes single words", function() { /* … */});
   it("makes the rest of the string lowercase", function() {
     expect(capitalize("javaScript")).to.equal("Javascript");
   });
});

firing the npm test command would log the following,

capitalize
✓ capitalizes single words
✓ makes the rest of the string lowercase
2 passing (10ms)

The same when written with jasmine would simply log two green dots denoting that the tests were successful. So, is there any way to achieve the mocha like logs ? As the official docs do not help in this regard !

Upvotes: 4

Views: 1163

Answers (2)

Bastien Caudan
Bastien Caudan

Reputation: 4490

You can use jasmine-spec-reporter, it is a jasmine reporter that display output this way:

Spec started

  first suite
    ✓ should be ok
    ✗ should failed
      - Expected true to be false.

Upvotes: 3

tehbeardedone
tehbeardedone

Reputation: 2858

If you use Karma to run your tests you can accomplish this. I use a reporter called karma-mocha-reporter. You can find more details here.It produces output in the console like this:

enter image description here

Upvotes: 1

Related Questions