You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
fix(ngMock window.inject): fix collecting stack trace in PhantomJS
Add support for collecting current stack trace information in browsers
(e.g. PhantomJS) that do not automatically store the current stack trace
information in a newly created `Error` object's `stack` property, but
only add it there once the `Error` gets thrown.
The original implementation works fine in Firefox & Chrome, but fails on
PhantomJS where it, for example, breaks karma's error reporting in cases
when an exception for thrown in a test like the following:
```
it('the holy crusade', inject(function () {
var x = {};
x.holyGrail();
}));
```
where the ngMock `inject()` implementation would incorrectly add the word
`undefined` to the end of the collected error stack trace information,
thus causing the main error description to be reported back to karma as
`undefined`.
The whole `Error.stack` property and its behaviour is not standardized so
there is no one true implementation that we can assume is used by all
angular compatible browsers.
MSDN JavaScript `stack Property (Error) (JavaScript)` docs found at
http://msdn.microsoft.com/en-us/library/windows/apps/hh699850.aspx also
seem to match the PhantomJS implementation.
0 commit comments