1

For example I have the following spec:

 it('All set should pass', function(){
     expect(string1).myMatcherCheckIfEquil(string2);
     expect(string2).myMatcherCheckIfContain(string3);
     expect(num1).myMatcherCheckIfTrue(true);
 })

Suppose all my matchers have pass and failed messages, for instance:

  exports.matchers = {
        myMatcherCheckIfEquil: function () { 

            return {
                  compare: function (actual, expected) {
                   var result = { pass: actual == expected }
                   !result.pass ? result.message = "The string " + expected + ' does not equal to ' + actual : result.message = "The strings are equal";
                    return result;           

           }
     }
},  

Is it possible to print passe and failed messages in command line like in the example below:

Spec started
F
  All set should pass:
      The strings are equal
      string2 does NOT contain string3
      The num1 is true

Thanks in advance.

Bastien Caudan
  • 4,482
  • 1
  • 17
  • 29
Nadin
  • 61
  • 8

0 Answers0