Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix(toDebugString): change replacement string
Browse files Browse the repository at this point in the history
As discussed in #10085, the original replacement string can be treated
as html when displayed by the browser so it replaces it with '...' string.

Closes #10103
  • Loading branch information
kwypchlo authored and petebacondarwin committed Sep 7, 2015
1 parent 20fb626 commit 0ca8b1d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/stringify.js
Expand Up @@ -9,7 +9,7 @@ function serializeObject(obj) {
val = toJsonReplacer(key, val);
if (isObject(val)) {

if (seen.indexOf(val) >= 0) return '<<already seen>>';
if (seen.indexOf(val) >= 0) return '...';

seen.push(val);
}
Expand Down
2 changes: 1 addition & 1 deletion test/minErrSpec.js
Expand Up @@ -65,7 +65,7 @@ describe('minErr', function() {
a.b.a = a;

var myError = testError('26', 'a is {0}', a);
expect(myError.message).toMatch(/a is {"b":{"a":"<<already seen>>"}}/);
expect(myError.message).toMatch(/a is {"b":{"a":"..."}}/);
});

it('should preserve interpolation markers when fewer arguments than needed are provided', function() {
Expand Down
4 changes: 2 additions & 2 deletions test/stringifySpec.js
Expand Up @@ -9,7 +9,7 @@ describe('toDebugString', function() {
expect(toDebugString()).toEqual('undefined');
var a = { };
a.a = a;
expect(toDebugString(a)).toEqual('{"a":"<<already seen>>"}');
expect(toDebugString([a,a])).toEqual('[{"a":"<<already seen>>"},"<<already seen>>"]');
expect(toDebugString(a)).toEqual('{"a":"..."}');
expect(toDebugString([a,a])).toEqual('[{"a":"..."},"..."]');
});
});

0 comments on commit 0ca8b1d

Please sign in to comment.