Use the stack trace from the Error object if supplied

Fixes #734
This commit is contained in:
Gregg Van Hove
2015-01-12 11:51:45 -08:00
parent 6c58024321
commit 3a93f845d6
7 changed files with 22 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
/*
Copyright (c) 2008-2014 Pivotal Labs
Copyright (c) 2008-2015 Pivotal Labs
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
Copyright (c) 2008-2014 Pivotal Labs
Copyright (c) 2008-2015 Pivotal Labs
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
Copyright (c) 2008-2014 Pivotal Labs
Copyright (c) 2008-2015 Pivotal Labs
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
Copyright (c) 2008-2014 Pivotal Labs
Copyright (c) 2008-2015 Pivotal Labs
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -853,7 +853,8 @@ getJasmineRequireObj().Env = function(j$) {
passed: false,
expected: '',
actual: '',
message: message
message: message,
error: error && error.message ? error : null
});
};
}
@@ -2419,7 +2420,7 @@ getJasmineRequireObj().matchersUtil = function(j$) {
return result;
function has(obj, key) {
return obj.hasOwnProperty(key);
return Object.prototype.hasOwnProperty.call(obj, key);
}
function isFunction(obj) {

View File

@@ -1,5 +1,5 @@
/*
Copyright (c) 2008-2014 Pivotal Labs
Copyright (c) 2008-2015 Pivotal Labs
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@@ -143,7 +143,8 @@ describe("Env integration", function() {
it('explicitly fails a spec', function(done) {
var env = new j$.Env(),
specDone = jasmine.createSpy('specDone');
specDone = jasmine.createSpy('specDone'),
errorObj = new Error('error message');
env.addReporter({
specDone: specDone,
@@ -161,9 +162,15 @@ describe("Env integration", function() {
})]
}));
expect(specDone).toHaveBeenCalledWith(jasmine.objectContaining({
description: 'has a message from an Error',
description: 'has a message and stack trace from an Error',
failedExpectations: [jasmine.objectContaining({
message: 'Failed: error message'
message: 'Failed: error message',
stack: {
asymmetricMatch: function(other) {
var firstLine = other.split('\n')[1];
return firstLine.indexOf('EnvSpec') >= 0;
}
}
})]
}));
done();
@@ -179,8 +186,8 @@ describe("Env integration", function() {
env.fail('messy message');
});
env.it('has a message from an Error', function() {
env.fail(new Error('error message'));
env.it('has a message and stack trace from an Error', function() {
env.fail(errorObj);
});
});

View File

@@ -445,7 +445,8 @@ getJasmineRequireObj().Env = function(j$) {
passed: false,
expected: '',
actual: '',
message: message
message: message,
error: error && error.message ? error : null
});
};
}