diff options
author | Timmy Willison <timmywil@users.noreply.github.com> | 2024-03-27 10:36:35 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-27 10:36:35 -0400 |
commit | b9d333acef65a68d68b169b6acbbf96965414728 (patch) | |
tree | 1045816204bebe5e5e3ab59290ea8f10202c03a8 /test/runner/listeners.js | |
parent | 063831b6378d518f9870ec5c4f1e7d5d16e04f36 (diff) | |
download | jquery-b9d333acef65a68d68b169b6acbbf96965414728.tar.gz jquery-b9d333acef65a68d68b169b6acbbf96965414728.zip |
Tests: improve diffing for values of different types
Close gh-5454
Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
Diffstat (limited to 'test/runner/listeners.js')
-rw-r--r-- | test/runner/listeners.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/runner/listeners.js b/test/runner/listeners.js index cca2bbd62..61a98e7ce 100644 --- a/test/runner/listeners.js +++ b/test/runner/listeners.js @@ -53,6 +53,17 @@ return nu; } } + + // Serialize Symbols as string representations so they are + // sent over the wire after being stringified. + if ( typeof value === "symbol" ) { + + // We can *describe* unique symbols, but note that their identity + // (e.g., `Symbol() !== Symbol()`) is lost + var ctor = Symbol.keyFor( value ) !== undefined ? "Symbol.for" : "Symbol"; + return ctor + "(" + JSON.stringify( value.description ) + ")"; + } + return value; } return derez( object ); |