Skip to content

Commit

Permalink
feat(deps): Remove core-js dependency. (#3379)
Browse files Browse the repository at this point in the history
The core-js was used for dom-serialize, used to support a single function
in stringify (serialize) for a single rare browser, IE8, in logs sent back to
the server.  By dropping this dependency we reduce the size of karma with
minimal impact on use cases.
  • Loading branch information
johnjbarton authored Oct 16, 2019
1 parent 3ffcd83 commit 0d70809
Show file tree
Hide file tree
Showing 5 changed files with 1,527 additions and 1,526 deletions.
1 change: 0 additions & 1 deletion client/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* global io */
/* eslint-disable no-new */

require('core-js/stable')
var Karma = require('./karma')
var StatusUpdater = require('./updater')
var util = require('../common/util')
Expand Down
14 changes: 12 additions & 2 deletions common/stringify.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
var serialize = require('dom-serialize')
var serialize = null
try {
serialize = require('dom-serialize')
} catch (e) {
// Ignore failure on IE8
}

var instanceOf = require('./util').instanceOf

function isNode (obj) {
Expand Down Expand Up @@ -56,7 +62,11 @@ function stringify (obj, depth) {
} else if (obj.outerHTML) {
return obj.outerHTML
} else if (isNode(obj)) {
return serialize(obj)
if (serialize) {
return serialize(obj)
} else {
return 'Skipping stringify, no support for dom-serialize'
}
} else if (instanceOf(obj, 'Error')) {
return obj.toString() + '\n' + obj.stack
} else {
Expand Down
Loading

0 comments on commit 0d70809

Please sign in to comment.