Skip to content

Commit

Permalink
Merge pull request karma-runner#2951 from johnjbarton/fix-2942
Browse files Browse the repository at this point in the history
fix(common): Proxy function toString does not contain Proxy.
  • Loading branch information
zzo authored May 2, 2018
2 parents bc1453e + 4fb3484 commit a6577d9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 2 additions & 2 deletions common/stringify.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ var stringify = function stringify (obj, depth) {
return obj.toString().replace(/\{[\s\S]*\}/, '{ ... }')
} catch (err) {
if (err instanceof TypeError) {
// Proxy(function abc(...) { ... })
return 'Proxy(function ' + (obj.name || '') + '(...) { ... })'
// Support older browsers
return 'function ' + (obj.name || '') + '() { ... }'
} else {
throw err
}
Expand Down
5 changes: 1 addition & 4 deletions test/client/stringify.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,8 @@ describe('stringify', function () {
// http://caniuse.com/#feat=proxy
if (window.Proxy) {
it('should serialize proxied functions', function () {
var abcProxy = new Proxy(function abc (a, b, c) { return 'whatever' }, {})
var defProxy = new Proxy(function (d, e, f) { return 'whatever' }, {})

assert.deepEqual(stringify(abcProxy), 'Proxy(function abc(...) { ... })')
assert.deepEqual(stringify(defProxy), 'Proxy(function (...) { ... })')
assert.deepEqual(stringify(defProxy), 'function () { ... }')
})
}

Expand Down

0 comments on commit a6577d9

Please sign in to comment.