exampleScripts.forEach(function(element) { let fileName = path.basename(element).replace(/\..*/, ""), savedTestPath = path.join(savedTestDir, `${fileName}-output.txt`) describe(element, function() { it(`Should match ${savedTestPath}`, function(deferred) { exec(`COLUMNS=${pkg.defaultTestColumns} node ${element} --color=always`, function (error, stdout /* , stderr */) { if (error !== null) { grunt.log.error(`Exec error: ${error}`) } var subname = fileName.replace(/\..*/, ""), filepath = path.join(savedTestDir, `${subname}-output.txt`), expected1 = fs.readFileSync(filepath, "utf-8") // example result should match saved output stdout.should.equal(expected1) deferred() } ) }) }) })
},function(err){ var grunt = require('grunt'); grunt.task.init = function() {}; grunt.initConfig(gr_config); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-css'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.tasks(['concat','cssmin','uglify'], {}, function() { fs.writeFileSync(__base+"static/build/index.html",[ '<link rel="stylesheet" href="/build/index.css">', '<span src="/build/template.html" ></span> ' ].join("\n\n")); grunt.log.ok('Done running tasks.'); console.log("Rebuild bundle is done !"); final();