data
argument of createTextNode
is not coerced into a string
#1380
Labels
bug
Something isn't working
data
argument of createTextNode
is not coerced into a string
#1380
Describe the bug
Hello! I'm filing this issue in response to an issue that got raised over at testing-library/svelte-testing-library#343.
document.createTextNode(data)
is used to create text nodesdata
is expected to be a DOMStringcreateTextNode
, it will be coerced into a stringnode.data
ends up not a string, causing problems in downstream consumersTo Reproduce
> node index.js 2 number
In the case of the issue filed in
@testing-library/svelte
:svelte@4
erroneously passes a non-string tocreateTextNode
, and then the pretty printing library that is used to print test results chokes because it tries to do aString.replace
onnode.data
, which may not be a stringExpected behavior
I expect the resulting
data
property ofcreateTextNode
to always be a stringAdditional context
Tested with
happy-dom@14.4.0
The text was updated successfully, but these errors were encountered: