Normalize line endings to support both LF and CRLF

This should fix build failures on Windows caused by line-ending
mismatch.
This commit is contained in:
Miroslav Bajtoš 2016-09-23 11:16:26 +02:00
parent 748a728a4f
commit 49ed10caaf
1 changed files with 7 additions and 2 deletions

View File

@ -803,10 +803,11 @@ describe('executor', function() {
.get('/') .get('/')
.end(function(err, res) { .end(function(err, res) {
if (err) return done(err); if (err) return done(err);
expect(res.text).to.eql(('<!DOCTYPE html>\n<html>\n<head lang="en">\n' + var EXPECTED_TEXT = '<!DOCTYPE html>\n<html>\n<head lang="en">\n' +
' <meta charset="UTF-8">\n <title>simple-app</title>\n' + ' <meta charset="UTF-8">\n <title>simple-app</title>\n' +
'</head>\n<body>\n<h1>simple-app</h1>\n' + '</head>\n<body>\n<h1>simple-app</h1>\n' +
'</body>\n</html>').replace(/\n/g, os.EOL)); '</body>\n</html>';
expect(normalizeEols(res.text)).to.eql(normalizeEols(EXPECTED_TEXT));
done(); done();
}); });
}); });
@ -1128,3 +1129,7 @@ function envAppInstructions() {
env: 'test', env: 'test',
}); });
} }
function normalizeEols(str) {
return str.replace(/\r\n/g, '\n');
}