Also, dev_boot.js is now a copy of boot.js and has additional changes to load jasmine the second time, into the j$ reference.
46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
//TODO: expectation result may make more sense as a presentation of an expectation.
|
|
getJasmineRequireObj().buildExpectationResult = function() {
|
|
function buildExpectationResult(options) {
|
|
var messageFormatter = options.messageFormatter || function() {},
|
|
stackFormatter = options.stackFormatter || function() {};
|
|
|
|
return {
|
|
matcherName: options.matcherName,
|
|
expected: options.expected,
|
|
actual: options.actual,
|
|
message: message(),
|
|
stack: stack(),
|
|
passed: options.passed
|
|
};
|
|
|
|
function message() {
|
|
if (options.passed) {
|
|
return "Passed.";
|
|
} else if (options.message) {
|
|
return options.message;
|
|
} else if (options.error) {
|
|
return messageFormatter(options.error);
|
|
}
|
|
return "";
|
|
}
|
|
|
|
function stack() {
|
|
if (options.passed) {
|
|
return "";
|
|
}
|
|
|
|
var error = options.error;
|
|
if (!error) {
|
|
try {
|
|
throw new Error(message());
|
|
} catch (e) {
|
|
error = e;
|
|
}
|
|
}
|
|
return stackFormatter(error);
|
|
}
|
|
}
|
|
|
|
return buildExpectationResult;
|
|
};
|