Don't mutate suite's failedExpectations from env
This commit is contained in:
@@ -1252,7 +1252,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
if (!envOptions.suppressLoadErrors) {
|
if (!envOptions.suppressLoadErrors) {
|
||||||
installGlobalErrors();
|
installGlobalErrors();
|
||||||
globalErrors.pushListener(function loadtimeErrorHandler(error) {
|
globalErrors.pushListener(function loadtimeErrorHandler(error) {
|
||||||
topSuite.result.failedExpectations.push({
|
topSuite.addExpectationResult(false, {
|
||||||
passed: false,
|
passed: false,
|
||||||
globalErrorType: 'load',
|
globalErrorType: 'load',
|
||||||
message: error.message,
|
message: error.message,
|
||||||
@@ -2597,6 +2597,13 @@ getJasmineRequireObj().buildExpectationResult = function(j$) {
|
|||||||
globalErrorType: options.globalErrorType
|
globalErrorType: options.globalErrorType
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (options.filename !== undefined) {
|
||||||
|
result.filename = options.filename;
|
||||||
|
}
|
||||||
|
if (options.lineno !== undefined) {
|
||||||
|
result.lineno = options.lineno;
|
||||||
|
}
|
||||||
|
|
||||||
if (!result.passed) {
|
if (!result.passed) {
|
||||||
if (options.error && !j$.private.isString(options.error)) {
|
if (options.error && !j$.private.isString(options.error)) {
|
||||||
if ('code' in options.error) {
|
if ('code' in options.error) {
|
||||||
|
|||||||
@@ -53,17 +53,17 @@ describe('Global error handling (integration)', function() {
|
|||||||
passed: false,
|
passed: false,
|
||||||
globalErrorType: 'load',
|
globalErrorType: 'load',
|
||||||
message: 'Uncaught SyntaxError: Unexpected end of input',
|
message: 'Uncaught SyntaxError: Unexpected end of input',
|
||||||
stack: '@borkenSpec.js:42',
|
|
||||||
filename: 'borkenSpec.js',
|
filename: 'borkenSpec.js',
|
||||||
lineno: 42
|
lineno: 42,
|
||||||
|
matcherName: undefined,
|
||||||
|
stack: jasmine.any(String)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
passed: false,
|
passed: false,
|
||||||
globalErrorType: 'load',
|
globalErrorType: 'load',
|
||||||
message: 'ENOCHEESE',
|
message: 'ENOCHEESE',
|
||||||
stack: error.stack,
|
matcherName: undefined,
|
||||||
filename: undefined,
|
stack: jasmine.any(String)
|
||||||
lineno: undefined
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
if (!envOptions.suppressLoadErrors) {
|
if (!envOptions.suppressLoadErrors) {
|
||||||
installGlobalErrors();
|
installGlobalErrors();
|
||||||
globalErrors.pushListener(function loadtimeErrorHandler(error) {
|
globalErrors.pushListener(function loadtimeErrorHandler(error) {
|
||||||
topSuite.result.failedExpectations.push({
|
topSuite.addExpectationResult(false, {
|
||||||
passed: false,
|
passed: false,
|
||||||
globalErrorType: 'load',
|
globalErrorType: 'load',
|
||||||
message: error.message,
|
message: error.message,
|
||||||
|
|||||||
@@ -23,6 +23,13 @@ getJasmineRequireObj().buildExpectationResult = function(j$) {
|
|||||||
globalErrorType: options.globalErrorType
|
globalErrorType: options.globalErrorType
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (options.filename !== undefined) {
|
||||||
|
result.filename = options.filename;
|
||||||
|
}
|
||||||
|
if (options.lineno !== undefined) {
|
||||||
|
result.lineno = options.lineno;
|
||||||
|
}
|
||||||
|
|
||||||
if (!result.passed) {
|
if (!result.passed) {
|
||||||
if (options.error && !j$.private.isString(options.error)) {
|
if (options.error && !j$.private.isString(options.error)) {
|
||||||
if ('code' in options.error) {
|
if ('code' in options.error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user