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

Commit 0ca8b1d

Browse files
kwypchlopetebacondarwin
authored andcommitted
fix(toDebugString): change replacement string
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
1 parent 20fb626 commit 0ca8b1d

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/stringify.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function serializeObject(obj) {
99
val = toJsonReplacer(key, val);
1010
if (isObject(val)) {
1111

12-
if (seen.indexOf(val) >= 0) return '<<already seen>>';
12+
if (seen.indexOf(val) >= 0) return '...';
1313

1414
seen.push(val);
1515
}

test/minErrSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('minErr', function() {
6565
a.b.a = a;
6666

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

7171
it('should preserve interpolation markers when fewer arguments than needed are provided', function() {

test/stringifySpec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('toDebugString', function() {
99
expect(toDebugString()).toEqual('undefined');
1010
var a = { };
1111
a.a = a;
12-
expect(toDebugString(a)).toEqual('{"a":"<<already seen>>"}');
13-
expect(toDebugString([a,a])).toEqual('[{"a":"<<already seen>>"},"<<already seen>>"]');
12+
expect(toDebugString(a)).toEqual('{"a":"..."}');
13+
expect(toDebugString([a,a])).toEqual('[{"a":"..."},"..."]');
1414
});
1515
});

0 commit comments

Comments
 (0)