Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes a bug where css.parse returns {} instead of a function #171

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

uzikilon
Copy link

@uzikilon uzikilon commented Dec 1, 2019

What:

Replaces the way the CSS parse utility is imported

Why:

Fixes a bug where css.parse returns {} instead of a function in ts-jest

TypeError: (0 , _css.parse) is not a function

node : v13.2.0
"ts-jest: "^24.1.0",
"@testing-library/jest-dom": "^4.2.4",

How:

Checklist:

  • Documentation "N/A"
  • Tests "N/A"
  • Updated Type Definitions "N/A"
  • Ready to be merged

Fixes a bug where css.parse returns {} instead of a function in ts-jest
```
TypeError: (0 , _css.parse) is not a function
```

node : v13.2.0
"ts-jest: "^24.1.0",
"@testing-library/jest-dom": "^4.2.4",
@gnapse
Copy link
Member

gnapse commented Dec 2, 2019

@uzikilon can you expand a little bit more on how/when/where this bug happens? I'm checking the css lib documentation and I see that the recommended way to import it is from the module's default import and and not from a subpath. Maybe what we should do is import it like this instead:

import css from 'css'

// Then use it like this:
css.parse(...)

@uzikilon
Copy link
Author

uzikilon commented Dec 2, 2019

The bug is a specific typescript issue, accrues any time we run toHaveStyle on a typescript test loaded with ts-jest.

This is more of a workaround than a solution.
I suppose the real bug is in the CSS library and not jest-dom.

@gnapse
Copy link
Member

gnapse commented Dec 2, 2019

Oh thanks, that clarifies it.

Could you raise the issue in that library without closing this one, and you can reference this issue over there? I'd rather not introduce these kind of ad-hoc workarounds here, at least not until we check if there's a fix at the source.

Base automatically changed from master to main January 20, 2021 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants