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
The toHaveCompiledCss() jest matcher from @compiled/jest does not work when there are styles containing modern at-rules, such as @starting-style and @container.
Describe the bug
The
toHaveCompiledCss()
jest matcher from@compiled/jest
does not work when there are styles containing modern at-rules, such as@starting-style
and@container
.This appears to be due to the
css
library used to parse the CSS into an AST object: https://github.com/reworkcss/cssError:
Code referenced in error: https://github.com/atlassian-labs/compiled/blob/master/packages/jest/src/matchers.ts#L154
This lines up with some open some in
reworkcss/css
:reworkcss/css
seems to inactive. It might be worth looking into migrating to@adobe/css-tools
instead, which is forked offreworkcss/css
: https://github.com/adobe/css-tools@testing-library/jest-dom
already uses it too.@adobe/css-tools
was updated to support these at-rules in the last few years:@starting-style
: add support for @starting-style adobe/css-tools#319@container
: add atContainer rule support adobe/css-tools#97To Reproduce
Steps to reproduce the behavior:
Create a simple jest unit test, like below (this file is a good place to quickly add it):
When
toHaveCompiledCss
runs, the above error will be thrown.Expected behavior
An error is not thrown when
toHaveCompiledCss
is used.The text was updated successfully, but these errors were encountered: