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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

import parse directly from css #415

Merged
merged 2 commits into from Nov 2, 2021

Conversation

yannbf
Copy link
Contributor

@yannbf yannbf commented Oct 19, 2021

Hey everyone! Thanks for this incredible library 馃寛

What:

At Storybook we are developing an addon that will allow developers to run interaction tests directly in the browser, using testing library. We'd also love to include the matcher extenders so that developers can use the assertions from jest-dom/extend-expect, however importing things directly from css result in the following failure:
Module not found: Error: Can't resolve 'fs'

This is an issue that happened as well in the testing-library/jasmine-dom package and was addressed with the exact same fix as this PR: testing-library/jasmine-dom#8

Why:

These changes would allow this library to run in the browser without breaking

How:

Given that the library only needs cssParse, there is no need to import it from the root of the package. Importing it from the root makes other files be imported as well, which results in the error mentioned above.

Checklist:

  • Documentation
  • Tests
  • Updated Type Definitions
  • Ready to be merged

- This will avoid having to access `fs` which will break in browser environments
Copy link
Member

@nickmccurdy nickmccurdy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good thinking, thanks for the contribution!

@codecov
Copy link

codecov bot commented Nov 2, 2021

Codecov Report

Merging #415 (2ebfbbe) into main (35ab97d) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #415   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           26        26           
  Lines          620       620           
  Branches       227       227           
=========================================
  Hits           620       620           
Impacted Files Coverage 螖
src/utils.js 100.00% <100.00%> (酶)

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update 35ab97d...2ebfbbe. Read the comment docs.

@nickmccurdy
Copy link
Member

nickmccurdy commented Nov 2, 2021

@all-contributors add @yannbf for code

@allcontributors
Copy link
Contributor

@nickmccurdy

I've put up a pull request to add @yannbf! 馃帀

@nickmccurdy nickmccurdy merged commit 4cb606c into testing-library:main Nov 2, 2021
@github-actions
Copy link

github-actions bot commented Nov 2, 2021

馃帀 This PR is included in version 5.15.0 馃帀

The release is available on:

Your semantic-release bot 馃摝馃殌

@IanGrainger
Copy link

Looks Identical to: testing-library/jasmine-dom#8 - which was the change for Jasmine - so seems good! 馃憤 thanks for the @ :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants