Gutenberg: Testing on Windows

Created on 28 Jun 2018  Â·  9Comments  Â·  Source: WordPress/gutenberg

It's been bothering me for a while that running npm test on Windows totally fails :)

The first thing is ESLint:

..............................................
 312:2    error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
 313:1    error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
 314:25   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style

✖ 75569 problems (75569 errors, 0 warnings)

(yep, there are 75569 lines of that...)

Adding "linebreak-style": 0, to eslint/config.js fixes these, but there are about 95 more where the LF breaks are backed-in the test itself.

Should we try to fix this? Seems git handles line breaks automatically pretty well, and forcing it to do LF everywhere might be dangerous/comes at a cost (although that would be my personal preference). Perhaps the better option would be to remove the line breaks from the tests or find a way to ignore them?

Automated Testing

Most helpful comment

I think we should want these tests to run gracefully on Windows.

All 9 comments

Noting this is inherited from upstream eslint-config-wordpress project:

https://github.com/WordPress-Coding-Standards/eslint-config-wordpress/blob/0660e2966824f2615dc0c6c4111363a5bae5cf58/index.js#L66-L67

cc @ntwb

Actually, can ignore that if I'm the only one (still) trying to code on Windows... I can keep "fixing" them before running the tests :)

I think we should want these tests to run gracefully on Windows.

Thanks, will get this fixed this weekend 😄

Open package.json, added following rules under rules line:

"rules": {
  "linebreak-style": 0,
  "global-require": 0,
  ...

for VScode users: click the option at the bottom-right of the window and set it to LF from CRLF
errors will fixed for me

The problem here is that after merging master to a branch, all updated files get CRLF line endings. This is done automatically by git and can be 100's of files :(

At the same time git -always- converts CRLF to LF on push, so maybe we can turn that offending option off for Windows?

This issue persists, so adding a bit more info here about unit test failures, as the ticket description only mentions the lint task.

Running npm run test-unit on Windows 10 returns failures in 6 test suites, including 12 snapshots:

  • most of the snapshot failures come from dependency-extraction-webpack-plugin tests and are caused by diffs in dependency version hash values
  • env package config tests are failing on an object comparison with diff path values
  • a couple storybook snapshots are failing where emotion-generated CSS is being rearranged (?)
  • full content post fixture and paste handler integration tests fail with what seem to be line ending differences (no visible diff)

Having issues too, running tests on Windows 10!

I also met the same issue and you can fix it by following the answer here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

spocke picture spocke  Â·  3Comments

mhenrylucero picture mhenrylucero  Â·  3Comments

moorscode picture moorscode  Â·  3Comments

nylen picture nylen  Â·  3Comments

youknowriad picture youknowriad  Â·  3Comments