klei / grunt-injector

Inject references to files into other files (think scripts and stylesheets into an html file)
MIT License
106 stars 38 forks source link

lineEnding is hardcoded to default to \n #37

Closed jt000 closed 8 years ago

jt000 commented 8 years ago

When I run the unit tests on windows I get the following error:

>> injector - customSort
>> Message: should inject files ordered with a custom sorting function.
>> Error: '\r\nvar files = [\r\n/** tagstart /\n  {ext: \'html\', file: \'/component.html\'},\n  {ext: \'js\', file: \'/script.js\'},\n  {ext: \'css\', file: \'/style.css\'},\n/* tagend /\r
\n];\r\n' == '\r\nvar files = [\r\n/* tagstart /\r\n  {ext: \'html\', file: \'/component.html\'},\r\n  {ext: \'js\', file: \'/script.js\'},\r\n  {ext: \'css\', file: \'/style.css\'},\r\n/*
tagend */\r\n];\r\n'
>> at Object.exports.injector.customSort (test\injector_test.js:179:10)
>> at Object.exports.injector.setUp (test\injector_test.js:28:5)

The issue appears to be all the baseline files were created where the lineEnding is set to '\n'. This should default to grunt.util.linefeed to persist OS settings for linefeed and allow the unit tests to pass on Windows.

ptitgraig commented 8 years ago

Thanks for your PR. This is fixed by https://github.com/klei/grunt-injector/pull/36 and will be available in next release