I want to print a custom message with passed, Thanks in advance

  • which jasmine reporter package you are calling for reporting? Jul 12, 2018 at 1:09

2 Answers 2


I have done it . We may use Jasmine Custom Matchers

We can override the default messaging in the Jasmine reporter by defining the custom matcher in the global scope and overriding the default message variable as follows:

    beforeEach(function () {
            toReport: function () {
                return {
                    compare: function (actual, expected, msg) {
                        var result = {pass: actual == expected};
                        result.message = msg;
                        return result;

And it can be used in expect statements like below inside err function block:

expect(true).toReport(true, "Perform operation X succesfully because of " + customSuccessMessage); 
expect(false).toReport(true, "Unable to perform required operation because of " + err.message); 

Jasmine documentation explains how to create a custom reporter: https://jasmine.github.io/tutorials/custom_reporter

However, maybe there is already some that you can use (or modify) to fit your needs. See the following:



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.