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 ) {
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")
stdout.should.equal(expected1)
deferred()
}
)
})
})
})