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

Fixed running unit tests under Windows #506

Merged
merged 1 commit into from Oct 10, 2017
Merged

Fixed running unit tests under Windows #506

merged 1 commit into from Oct 10, 2017

Conversation

Atvaark
Copy link
Contributor

@Atvaark Atvaark commented Oct 7, 2017

Upon cloning this repository with my windows git client the line endings of text files were converted from LF to CRLF. This causes the unit tests in prettify.test.js and a test in network.test.js to fail, since they expect LF line endings. This commit prevents git clients form converting the line endings in some test fixture files.

I guess the git client in the appveyor windows image doesn't automatically convert line endings and thus doesn't have this issue.

@gschier
Copy link
Contributor

gschier commented Oct 7, 2017

Now that you mention it, this should probably be in the root of the repository. We should always be using Unix line endings for every file, as it is now.

Note, this is already defined in .editorconfig https://github.com/getinsomnia/insomnia/blob/b3c37dc067414166029219836801c8f0c6f5f446/.editorconfig#L7

@Atvaark
Copy link
Contributor Author

Atvaark commented Oct 7, 2017

This .gitattributes file at root level should cover all files. I'll see if this also fixes my unit test problem.

.babelrc       text eol=lf
.editorconfig  text eol=lf
.eslintignore  text eol=lf
.eslintr       text eol=lf
.flowconfig    text eol=lf
.gitattributes text eol=lf
.gitignore     text eol=lf
.nvmrc         text eol=lf

*.css  text eol=lf
*.html text eol=lf
*.js   text eol=lf
*.json text eol=lf
*.less text eol=lf
*.md   text eol=lf
*.txt  text eol=lf
*.yml  text eol=lf

*.gif   binary
*.icns  binary
*.ico   binary
*.png   binary
*.woff2 binary

Edit
Looks good so far.

@gschier
Copy link
Contributor

gschier commented Oct 10, 2017

I'm no expert, but would this also work?

*       text eol=lf

*.gif   binary
*.icns  binary
*.ico   binary
*.png   binary
*.woff2 binary

Checkout text files with LF line endings.

This prevents auto conversion from LF to CRLF on windows,
which would break unit tests expecting LF line endings.
@Atvaark
Copy link
Contributor Author

Atvaark commented Oct 10, 2017

That should also work I guess.
I compared it to the config I posted above and noticed that binary files have both the binary attribute and eol: lf attribute. Don't know if that could cause git to accidentally normalize the files.
There's also * text=auto eol=lf which will cause git to guess if the file is a text or binary file before normalizing.

@gschier
Copy link
Contributor

gschier commented Oct 10, 2017

Ya, I'm not sure either. I guess we'll find out eventually if it isn't what we want.

The reason I wanted the wildcard up top is so we don't have to update .gitattributes if/when we add new file extensions.

Going to merge this one in 😄

@gschier gschier merged commit b80f757 into Kong:develop Oct 10, 2017
@Atvaark Atvaark deleted the windows-lf branch October 11, 2017 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants