eslint / eslint-transforms

Codemods for the ESLint ecosystem
Other
22 stars 8 forks source link

Chore: ensure consistent linebreaks when testing transforms #6

Closed vitorbal closed 7 years ago

vitorbal commented 7 years ago

What issue does this pull request address? Tests were failing in windows because jscodeshift transforms all line breaks of the input file into the OS-specific line break format. This caused the tests to compare the transform output (CRLF format) against the "expected result" fixture (LF format), which would always fail.

What changes did you make? (Give an overview) I made it so the tests now ensure all output being compared is using the same line break format, so the problem never happens again.

Is there anything you'd like reviewers to focus on?

nzakas commented 7 years ago

I'd probably call this a fix, since it's fixing a problem.

vitorbal commented 7 years ago

Thanks for the feedback! I renamed the function per your suggestion and changed the commit message to a fix.

nzakas commented 7 years ago

Lgtm

platinumazure commented 7 years ago

Anyone know how this will play with a .gitattributes (in repository containing code to be transformed) which specifies a line break style that doesn't match the OS default?

nzakas commented 7 years ago

It won't matter because the normalization is done before the comparison.