You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using babel-plugin-tester to test a Babel plugin I am working on. (Great tool BTW; thanks for sharing this.)
My tests were failing for no apparent reason. Then I realize that the following line of code was returning an error because of a difference with the line feed \r\n vs \n.
I fixed the problem by replacing the following line of code:
assert.equal(actual, output, 'actual output does not match output.js')
... with this ...
const normalizeNewline = require('normalize-newline');
assert.equal(normalizeNewline(actual), normalizeNewline(output), 'actual output does not match output.js')
The text was updated successfully, but these errors were encountered:
That makes sense. Normally in my projects I'll include a .gitattributes that includes this:
*.js text eol=lf
This helps me avoid these kinds of problems. That said, I can understand why this tool should be built to work regardless. So feel free to open a pull request to address this. Thanks!
Normally in my projects I'll include a .gitattributes that includes this:
I think this should be the accepted solution. The linefeed is currently hardcoded into babel so any test that expectes \r\n as a linefeed should actually fail. The babel repo itself uses text eol=lf so I don't think this is the right place for a fix. If anything then @babel/generator should be fixed.
Hello
I'm using
babel-plugin-tester
to test a Babel plugin I am working on. (Great tool BTW; thanks for sharing this.)My tests were failing for no apparent reason. Then I realize that the following line of code was returning an error because of a difference with the line feed
\r\n
vs\n
.I fixed the problem by replacing the following line of code:
... with this ...
The text was updated successfully, but these errors were encountered: