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
The last parameter 'error' is an Error instance. When this error is caught and sent to the context (via the reverse context), postMessage is used but Error objects can't be serialised in postMessage and so the call fails and the error never makes it to the parent context. The error thrown in this case looks like: Uncaught DOMException: Failed to execute 'postMessage' on 'Window': Error could not be cloned.
This seems to specifically be for errors in the JS document itself (syntax errors etc) rather than asserts in the tests themselves.
The offending code is in reverse-context.js, lines 30-36:
This could be corrected by adding a transform to the arguments array that converts Error objects into strings, e.g.
DIRECT_METHODS = ['error', 'log', 'complete', 'result'];
DIRECT_METHODS.forEach(method => {
karma[method] = function() {
var args = Array.prototype.slice.call(arguments);
for (var i = 0, l = args.length; i < l; ++i) {
if (args[i] instanceof Error) {
args[i] = args[i].stack || args[i].toString();
}
}
callParentKarmaMethod(method, args);
}
karma[method].displayName = method+' (proxied)';
});
This does mean however that karma never sees an Error object on the other end, only a string, but it gets sent right to karma.error so this might be ok.
The text was updated successfully, but these errors were encountered:
The callback of window.onerror is as follows:
window.onerror = function(message, source, lineno, colno, error) { ... }
The last parameter 'error' is an Error instance. When this error is caught and sent to the context (via the reverse context), postMessage is used but Error objects can't be serialised in postMessage and so the call fails and the error never makes it to the parent context. The error thrown in this case looks like:
Uncaught DOMException: Failed to execute 'postMessage' on 'Window': Error could not be cloned.
This seems to specifically be for errors in the JS document itself (syntax errors etc) rather than asserts in the tests themselves.
The offending code is in reverse-context.js, lines 30-36:
This could be corrected by adding a transform to the arguments array that converts Error objects into strings, e.g.
This does mean however that karma never sees an Error object on the other end, only a string, but it gets sent right to karma.error so this might be ok.
The text was updated successfully, but these errors were encountered: