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

fix: toString should stringify node #74

Merged
merged 4 commits into from
Mar 7, 2019
Merged

fix: toString should stringify node #74

merged 4 commits into from
Mar 7, 2019

Conversation

shellscape
Copy link
Owner

This PR contains:

  • bugfix
  • feature
  • refactor
  • tests
  • documentation
  • metadata

Breaking Changes?

  • yes
  • no

If yes, please describe the breakage.

Please Describe Your Changes

Fixes #72. Using toString or String(node) is failing due to the base PostCSS stringifier not being able to recognize our node types.

This isn't as elegant as I'd like, and does involve some code duplication that I'm not a fan of, but it gets the job done for the time being.

Copy link
Collaborator

@jwilsson jwilsson left a comment

Choose a reason for hiding this comment

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

LGTM

@shellscape
Copy link
Owner Author

@jonathantneal @jwilsson went back over the PR today and found that the tests for toString() weren't actually testing the node's toString - a copy/pasted typo was just checking a string against it's own toString.

That led me to refactor quite a bit, and revealed several subsequent shortcomings, all of which should now be fixed. I've improved the tests and coverage to guard against what I found moving forward. Please review again.

Copy link
Collaborator

@jonathantneal jonathantneal left a comment

Choose a reason for hiding this comment

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

I left one question, but it is non-blocking. Looks good!

lib/index.js Outdated Show resolved Hide resolved
@shellscape shellscape merged commit 3b10553 into master Mar 7, 2019
@shellscape shellscape deleted the fix/tostring branch March 7, 2019 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

String(node) should produce string or throw more helpful error
3 participants