Open aga5tya opened 7 years ago
@aga5tya thank you! Can you add a test?
@giuseppeg,, do i have to include a failure test case ? like a scenario expecting an error on the wrong styles. I'm new to unit testing stuff,, apologies in case its a trivial question.
@aga5tya hey no worries!
like a scenario expecting an error on the wrong styles
correct I would add a new fixture to tests/fixtures with some css error e.g. a missing semicolon:
export default () => (
<div>
<style jsx>{`
p {
color: red
width: 100%
}
`}</style>
</div>
)
And then the test in test/index.js
use t.throws
https://github.com/avajs/ava#throwsfunctionpromise-error-message
@giuseppeg , please review and guide. Updated the PR.
+1 Great
@aga5tya sorry I've been busy. The PR looks good, thank you!
While we are on it I was thinking that maybe we can print out some info about the error source too, what do you think?
I saw that the postcss error object has a showSourceCode
method that is really nice!
Also since the PostCSS processor is not loading the css from a file we get something like:
CssSyntaxError: <css input>:1:32: Missed semicolon
Would you be interested in fixing this too? <css input>
should be replaced with the component path and 1:32
with the loc
s in the component. Basically getCss
should also return start
and end
– something like this
@aga5tya want me to finish this branch?
can't wait for this
@giuseppeg, please do if you have time, i have been busy with lot of other things, won't have time until a month.
we have styled-jsx-postcss working on scaleapi.com 💯
Just curious, when will this get pulled into the current release?
I want to see if we can ship plugins support to styled-jsx (there is an open PR for it) and in case convert this repo to a plugin for styled-jsx instead of doing parallel development.
Fixes giuseppeg/styled-jsx-postcss#5