-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "similar" debugging to
toHaveCompiledCss
(#1619)
* Add "similar" debugging to `toHaveCompiledCss` I found it difficult to debug with `toHaveCompiledCss`, particularly in the case of local css variables being resolved by jest-dom (I think that's how it works), as the error for "could not find `padding: 8px`" doesn't tell you if it was wrong or just doesn't exist. ```tsx expect(element).toHaveCompiledCss({ paddingInlineEdit: '8px' }); ``` ```sh Could not find "padding-inline-end:8px" on <a data-testid="test-link" class="css-1mufnsm">…</a> element. ``` Now this should have a a clearer error: ```tsx Could not find "padding-inline-end:8px" on <a data-testid="test-link" class="css-1mufnsm">…</a> element. Found similar styles: padding-inline-end:var(--ds-space-0, 0px) padding-inline-end:var(--ds-space-100, 8px) ``` This could go a step further and show all css properties or have a debug mode I couldn't find, but that could get quite spammy… * chore: changeset
- Loading branch information
1 parent
da6fc56
commit 749994b
Showing
2 changed files
with
52 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@compiled/jest': patch | ||
--- | ||
|
||
Add "found similar styles" to assist debugging to the `toHaveCompiledCss` matcher. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters