I took a look at the source, and this implementation of expect:
jasmine.Spec.prototype.expect = function(actual) {
var positive = new (this.getMatchersClass_())(this.env, actual, this);
positive.not = new (this.getMatchersClass_())(this.env, actual, this, true);
return positive;
};
So, the property not
is the implementation of the same class, receiving this extra parameter to reverse the output:
jasmine.Matchers = function(env, actual, spec, opt_isNot) {
this.env = env;
this.actual = actual;
this.spec = spec;
this.isNot = opt_isNot || false; // reverse option set
this.reportWasCalled_ = false;
};
Finally, in jasmine.Matchers.matcherFn_
, it uses it to reverse the result:
if (this.isNot) {
result = !result;
}