Skip to content

Commit

Permalink
chore: make version test dynamic.
Browse files Browse the repository at this point in the history
  • Loading branch information
aorinevo committed Mar 30, 2020
1 parent b24141f commit d0c1bca
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tasks/test-bin.js
Expand Up @@ -74,7 +74,7 @@ const testCases = [
{
binInputParameters: ['-v'],
outputLocation: 'stdout',
expectedOutputSpec: './spec/expected/version.txt'
expectedOutput: require('../package.json').version
},
{
binInputParameters: [
Expand Down Expand Up @@ -165,10 +165,12 @@ const testCases = [
module.exports = function(grunt) {
grunt.registerTask('test:bin', function() {
testCases.forEach(
({ binInputParameters, outputLocation, expectedOutputSpec }) => {
({ binInputParameters, outputLocation, expectedOutputSpec, expectedOutput }) => {
const stdout = executeBinHandlebars(...binInputParameters);

const expectedOutput = fs.readFileSync(expectedOutputSpec, 'utf-8');

if( !expectedOutput && expectedOutputSpec){
expectedOutput = fs.readFileSync(expectedOutputSpec, 'utf-8');
}

const useStdout = outputLocation === 'stdout';
const normalizedOutput = normalizeCrlf(
Expand All @@ -188,6 +190,7 @@ module.exports = function(grunt) {
);
}
);

});
};

Expand Down

0 comments on commit d0c1bca

Please sign in to comment.