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
With 3.6.0 version, some tests with @testing-library/jest-domtoBeVisible() matcher break:
RangeError: Invalid string length
at compileSelector (node_modules/nwsapi/src/nwsapi.js:893:56)
at compile (node_modules/nwsapi/src/nwsapi.js:753:16)
at match_collect (node_modules/nwsapi/src/nwsapi.js:1358:16)
at Object._matches [as match] (node_modules/nwsapi/src/nwsapi.js:1413:35)
at exports.matchesDontThrow (node_modules/jsdom/lib/jsdom/living/helpers/selectors.js:29:36)
at matches (node_modules/jsdom/lib/jsdom/living/helpers/style-rules.js:50:10)
at node_modules/jsdom/lib/jsdom/living/helpers/style-rules.js:35:18
at Array.forEach (<anonymous>)
at handleSheet (node_modules/jsdom/lib/jsdom/living/helpers/style-rules.js:26:13)
at Array.forEach (<anonymous>)
To Reproduce
Steps to reproduce the behavior:
Add this test in project using xstyled:
import { render } from '@testing-library/react'
import { x } from '@xstyled/styled-component
it('should test', () => {
const { container } = render(<x.div bg={{ _: 'red' }} />)
expect(container).toBeVisible()
})
yarn test
the test should break with RangeError: Invalid string length error (see above)
It breaks on all tests on component with responsive default attribute _ and toBeVisible() matcher
it does not break if we have xs or sm instead of _ in bg props.
it does not break if another matcher as toBeInvalid() is used
it worked with previous version 3.5.1
Expected behavior
Should not have RangeError: Invalid string length error
Run npx envinfo --system --binaries --npmPackages @xstyled/system,@xstyled/styled-components,styled-components --markdown --clipboard
It is due to nwsapi package, it is an old package many others depend on.
The owner has fixed the issue but not published release on NPM yet.
You can patch module:
🐛 Bug Report
With
3.6.0
version, some tests with@testing-library/jest-dom
toBeVisible()
matcher break:To Reproduce
Steps to reproduce the behavior:
xstyled
:yarn test
RangeError: Invalid string length
error (see above)_
andtoBeVisible()
matcherxs
orsm
instead of_
inbg
props.toBeInvalid()
is used3.5.1
Expected behavior
RangeError: Invalid string length
errorRun
npx envinfo --system --binaries --npmPackages @xstyled/system,@xstyled/styled-components,styled-components --markdown --clipboard
Paste the results here:
The text was updated successfully, but these errors were encountered: