You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a symbol is used as an argument to an asymmetric matcher expect will fail when it tries to .join(', ') the arguments while printing the error report.
To Reproduce
There's no reason to want to do this specifically, but it does reproduce the issue.
Jest should be able to produce a clean diff which identifies the asymmetric matcher as: toBeSymbol<Symbol(bar)> but instead the expect package fails to build a diff and errors out with TypeError: Cannot convert a Symbol value to a string
Link to repl
repl.it demo Repl's standard Jest is version 22 so I had to import expect directly. Still isolates the issue.
I'll have a pull request soon. Even if it's not merged it'll still show exactly what the issue is.Having trouble building. Might have to postpone this. Apparently .join('') doesn't implicitly convert values to strings. So this line is failing when given a Symbol argument. maping the array toStrings fixes it.
The text was updated successfully, but these errors were encountered:
Ross-Esmond
changed the title
Custom asymmetric expect matchers aren't able to print Symbol samples in error reports.
Custom asymmetric expect matchers aren't able to print Symbol arguments in error reports.
Dec 18, 2018
ghostd
added a commit
to ghostd/jest
that referenced
this issue
Apr 26, 2020
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
🐛 Bug Report
If a symbol is used as an argument to an asymmetric matcher expect will fail when it tries to
.join(', ')
the arguments while printing the error report.To Reproduce
There's no reason to want to do this specifically, but it does reproduce the issue.
Expected behavior
Jest should be able to produce a clean diff which identifies the asymmetric matcher as:
toBeSymbol<Symbol(bar)>
but instead theexpect
package fails to build a diff and errors out withTypeError: Cannot convert a Symbol value to a string
Link to repl
repl.it demo Repl's standard Jest is version 22 so I had to import
expect
directly. Still isolates the issue.I'll have a pull request soon. Even if it's not merged it'll still show exactly what the issue is.Having trouble building. Might have to postpone this. Apparently.join('')
doesn't implicitly convert values to strings. So this line is failing when given aSymbol
argument.map
ing the arraytoString
s fixes it.The text was updated successfully, but these errors were encountered: