Open TimonVS opened 3 years ago
I'm having the same issue.
Thinking it would make sense to simply have it skip running the prettier
task if the options
are undefined
. It's just used to by Jest to ensure consistent formatting of the snapshot code, so it doesn't make sense to format the tailwind code anyway.
I'm having the same problem.
Describe the bug
First of all, thanks for this wonderful plugin!
I'm running into some problems when using this plugin with Jest. Inline snapshot testing (
toMatchInlineSnapshot
) in Jest uses Prettier (https://jestjs.io/docs/en/snapshot-testing#inline-snapshots), tests using inline snapshot testing start to fail as soon as you installprettier-plugin-tailwind
, tests that use non-inline snapshot testing or no snapshot testing at all work just fine.I did a bit of debugging and it boils down to the options argument in the
parse
function beingundefined
when ran by Prettier in Jest: https://github.com/Acidic9/prettier-plugin-tailwind/blob/master/src/parsers/typescript.ts#L12.I'm not yet sure if this is a bug with
plugin-prettier-tailwind
, Jest or Prettier. I'm hoping someone with more knowledge about the internal workings of these tools might shed some light on that :)To Reproduce
https://codesandbox.io/s/nameless-river-f9fuy?file=/index.test.js
Expected behavior
Inline snapshots should be formatted with
plugin-prettier-tailwind
.Versions: