Commit bb9a0a2b authored by Filipe Silva's avatar Filipe Silva Committed by Jesús Rodríguez

fix(e2e): create output dir if it doesn't exist (#217)

Fix #196
Fix #201
parent def6b934
...@@ -129,7 +129,26 @@ function Reporter(options) { ...@@ -129,7 +129,26 @@ function Reporter(options) {
fs.appendFileSync(outputFile, output); fs.appendFileSync(outputFile, output);
}; };
function ensureDirectoryExistence(filePath) {
var dirname = path.dirname(filePath);
if (directoryExists(dirname)) {
return true;
}
ensureDirectoryExistence(dirname);
fs.mkdirSync(dirname);
}
function directoryExists(path) {
try {
return fs.statSync(path).isDirectory();
}
catch (err) {
return false;
}
}
function initOutputFile(outputFile) { function initOutputFile(outputFile) {
ensureDirectoryExistence(outputFile);
var header = "Protractor results for: " + (new Date()).toLocaleString() + "\n\n"; var header = "Protractor results for: " + (new Date()).toLocaleString() + "\n\n";
fs.writeFileSync(outputFile, header); fs.writeFileSync(outputFile, header);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment