diff --git a/common/stringify.js b/common/stringify.js index 192a4847a..aece384d3 100644 --- a/common/stringify.js +++ b/common/stringify.js @@ -14,6 +14,8 @@ var stringify = function stringify (obj, depth) { } switch (typeof obj) { + case 'symbol': + return obj.toString() case 'string': return "'" + obj + "'" case 'undefined': diff --git a/test/client/stringify.spec.js b/test/client/stringify.spec.js index e51c85d37..a3643b2b3 100644 --- a/test/client/stringify.spec.js +++ b/test/client/stringify.spec.js @@ -4,6 +4,10 @@ var assert = require('assert') var stringify = require('../../common/stringify') describe('stringify', function () { + it('should serialize symbols', function () { + assert.deepEqual(stringify(Symbol.for('x')), "Symbol(x)") + }) + it('should serialize string', function () { assert.deepEqual(stringify('aaa'), "'aaa'") })