From 1d19d6197049cc50080e25089493c29e0d721d43 Mon Sep 17 00:00:00 2001 From: Alex Rickabaugh Date: Fri, 3 Nov 2017 11:11:47 -0700 Subject: [PATCH] fix(platform-browser): support Symbols in custom jasmineToString() method (#19794) It's illegal to coerce a Symbol to a string, and results in a TypeError: TypeError: Cannot convert a Symbol value to a string Previously, the custom jasmineToString() method monkey-patched onto Maps in platform-browser/testing/src/matchers.ts would coerce keys and values to strings. A change in a newer version of Jasmine calls this method more often, resulting in calls against Maps which contain Symbols in some applications, which causes crashes. The fix is to explicitly convert keys and values to strings, which does work on Symbols. --- packages/platform-browser/testing/src/matchers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/platform-browser/testing/src/matchers.ts b/packages/platform-browser/testing/src/matchers.ts index f43fe4e051..01417f570b 100644 --- a/packages/platform-browser/testing/src/matchers.ts +++ b/packages/platform-browser/testing/src/matchers.ts @@ -107,7 +107,7 @@ export const expect: (actual: any) => NgMatchers = _global.expect; return '' + m; } const res: any[] = []; - m.forEach((v: any, k: any) => { res.push(`${k}:${v}`); }); + m.forEach((v: any, k: any) => { res.push(`${String(k)}:${String(v)}`); }); return `{ ${res.join(',')} }`; };