From 2e21e2bc9a19c2be258c98a0c5c97e0f74228315 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Sun, 14 May 2017 23:10:14 +0200 Subject: [PATCH 1/3] Run integration test with `node handlebars -a ...` on Windows Fixes #1233 NodeJS files cannot be executed directly on Windows. --- tasks/test.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tasks/test.js b/tasks/test.js index d7ce04d0..e7825d01 100644 --- a/tasks/test.js +++ b/tasks/test.js @@ -1,11 +1,14 @@ var childProcess = require('child_process'), - fs = require('fs'); + fs = require('fs'), + os = require('os'); module.exports = function(grunt) { grunt.registerTask('test:bin', function() { var done = this.async(); - childProcess.exec('./bin/handlebars -a spec/artifacts/empty.handlebars', function(err, stdout) { + // On Windows, the executable handlebars.js file cannot be run directly + var prefix = os.type().match(/^Windows/) ? process.argv[0] : ''; + childProcess.exec(prefix + ' ./bin/handlebars -a spec/artifacts/empty.handlebars', function(err, stdout) { if (err) { throw err; } From ed879a6068d8c2ed27ab1f95154f1489eae46e59 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Sun, 14 May 2017 23:56:23 +0200 Subject: [PATCH 2/3] Ensure LF line-edings in handlebars-template fixtures (*.hbs) Fixes #1331 --- .gitattributes | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index 5e1a5da0..eeda54e2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,6 @@ -# Handlebars templates in test cases +# Handlebars-template fixtures in test cases need deterministic eol *.handlebars text eol=lf +*.hbs text eol=lf -# Lexer files +# Lexer files as well *.l text eol=lf From cc554a581337cd6b5ffdc90a36e79d8fe1c7a7d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luiz=20Am=C3=A9rico?= Date: Sun, 21 Aug 2016 22:50:20 +0200 Subject: [PATCH 3/3] Fix build in windows (cherry picked from commit 275ab37) --- tasks/test.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tasks/test.js b/tasks/test.js index e7825d01..342a2836 100644 --- a/tasks/test.js +++ b/tasks/test.js @@ -13,8 +13,9 @@ module.exports = function(grunt) { throw err; } - var expected = fs.readFileSync('./spec/expected/empty.amd.js'); - if (stdout.toString() !== expected.toString()) { + var expected = fs.readFileSync('./spec/expected/empty.amd.js').toString().replace(/\r\n/g, '\n'); + + if (stdout.toString() !== expected) { throw new Error('Expected binary output differed:\n\n"' + stdout + '"\n\n"' + expected + '"'); }