Removed unnecessary errorWithStack helper
This commit is contained in:
@@ -65,7 +65,7 @@ getJasmineRequireObj().Deprecator = function(j$) {
|
||||
|
||||
Deprecator.prototype.stackTrace_ = function() {
|
||||
const formatter = new j$.ExceptionFormatter();
|
||||
return formatter.stack(j$.util.errorWithStack()).replace(/^Error\n/m, '');
|
||||
return formatter.stack(new Error()).replace(/^Error\n/m, '');
|
||||
};
|
||||
|
||||
Deprecator.prototype.report_ = function(runnable, deprecation, options) {
|
||||
|
||||
@@ -148,7 +148,7 @@ getJasmineRequireObj().Expectation = function(j$) {
|
||||
return function() {
|
||||
// Capture the call stack here, before we go async, so that it will contain
|
||||
// frames that are relevant to the user instead of just parts of Jasmine.
|
||||
const errorForStack = j$.util.errorWithStack();
|
||||
const errorForStack = new Error();
|
||||
|
||||
return this.expector
|
||||
.compare(name, matcherFactory, arguments)
|
||||
|
||||
@@ -48,16 +48,9 @@ getJasmineRequireObj().util = function(j$) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, key);
|
||||
};
|
||||
|
||||
util.errorWithStack = function errorWithStack() {
|
||||
// Don't throw and catch. That makes it harder for users to debug their
|
||||
// code with exception breakpoints, and it's unnecessary since all
|
||||
// supported environments populate new Error().stack
|
||||
return new Error();
|
||||
};
|
||||
|
||||
function callerFile() {
|
||||
const trace = new j$.StackTrace(util.errorWithStack());
|
||||
return trace.frames[2].file;
|
||||
const trace = new j$.StackTrace(new Error());
|
||||
return trace.frames[1].file;
|
||||
}
|
||||
|
||||
util.jasmineFile = (function() {
|
||||
|
||||
Reference in New Issue
Block a user