Skip to content

Commit

Permalink
fix(adapter): filter functions from result.order (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
twolfson committed Aug 12, 2020
1 parent b95e574 commit 28f337c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/adapter.js
Expand Up @@ -191,8 +191,22 @@ function KarmaReporter (tc, jasmineEnv) {
// Any errors in top-level afterAll blocks are given here.
handleGlobalErrors(result)

// Remove functions from called back results to avoid IPC errors in Electron
// https://github.com/twolfson/karma-electron/issues/47
var cleanedOrder
if (result.order) {
cleanedOrder = {}
var orderKeys = Object.getOwnPropertyNames(result.order)
for (var i = 0; i < orderKeys.length; i++) {
var orderKey = orderKeys[i]
if (typeof result.order[orderKey] !== 'function') {
cleanedOrder[orderKey] = result.order[orderKey]
}
}
}

tc.complete({
order: result.order,
order: cleanedOrder,
coverage: window.__coverage__
})
}
Expand Down

0 comments on commit 28f337c

Please sign in to comment.