jasmine2-custom-message
                                
                                 jasmine2-custom-message copied to clipboard
                                
                                    jasmine2-custom-message copied to clipboard
                            
                            
                            
                        Custom messages for passed expectations
Hi, I have just a simple question. Could this library be updated so that it can write a message for passed 'expect' also?
As far as I understand jasmine won't provide this feature in future. According to https://github.com/jasmine/jasmine/issues/1127
Nevertheless, I extremally need this ability.
Hi, At the moment I have no plans for it.
@Sarkell you can just
const myExpectVariable = sut.whateverFunction();
since(function() {
    return `got ${myExpectVariable} expected ${this.actual} to be ${this.expected}`;
}).expect(myCheck(myExpectVariable)).toBeWhatever();
you don't need a feature for that.
@Sarkell @avrelian I'v solved this issue by overriding global jasmine functions - this code can be added in module as is :) Solution:
let jasmine = require('jasmine-core');
// Override build expectation result: Passed string problem
// https://github.com/jasmine/jasmine/issues/971
let buildExpectationResult = jasmine.buildExpectationResult();
jasmine.buildExpectationResult = function() {
	function buildExpectationResultWrapper(options) {
		let message = options ? options.message : '';
		let result = buildExpectationResult(options);
		if (result.passed && message) {
			result.message = message;
		}
		
		return result;
	}
	return buildExpectationResultWrapper;
}
@cheplv , i'm new to protractor/jasmine. would you be able to show an example on how to use your wrapper? thank you!
As an example of protractor.conf.js with override of Passed.
https://gist.github.com/cheplv/8801eaef7e807f55b17ff7cfe6b1d376
Launch with command like: NODE_ENV=dev protractorUrl="https://some-test.domain.com" node_modules/protractor/bin/protractor tests/e2e/protractor.conf.js
And use in spec like: since('User logged in').expect(User.isAuthenticated()).toBeTruthy();
@cheplv thank you! I did use your override function. But I don't have the jasmine custom messages packages and hence i'm not able to use since. Tried except(A).toEqual(B, 'test') to see if the message test is displayed when the test passes. But it did not get displayed in the report. Am i missing something?
@rajeshpadmanaban This thread is intended to solve jasmine2-custom-message since function success message. Add project to your dependencies and use as it intended :)