From 06adba4fdd833cee94e26539bef636079eff5666 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 17 Jul 2014 12:32:51 -0700 Subject: [PATCH] Cleanup temporary project output after running tests --- .gitignore | 1 - Jakefile | 13 +++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 9589707e25b..ef631d99d78 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,6 @@ tests/cases/perf/* test-args.txt ~*.docx tests/baselines/local/* -tests/baselines/reference/projectOutput/ tests/services/baselines/local/* tests/baselines/prototyping/local/* tests/baselines/rwc/* diff --git a/Jakefile b/Jakefile index 62fd6c878d0..622381b0380 100644 --- a/Jakefile +++ b/Jakefile @@ -288,7 +288,7 @@ var refRwcBaseline = "tests/baselines/rwc/reference/"; desc("Builds the test infrastructure using the built compiler"); task("tests", ["local", run].concat(libraryTargets)); -function exec(cmd) { +function exec(cmd, completeHandler) { var ex = jake.createExec([cmd]); // Add listeners for output and error ex.addListener("stdout", function(output) { @@ -298,6 +298,9 @@ function exec(cmd) { process.stderr.write(error); }); ex.addListener("cmdEnd", function() { + if (completeHandler) { + completeHandler(); + } complete(); }); try{ @@ -328,6 +331,12 @@ function writeTestConfigFile(tests, testConfigFile) { fs.writeFileSync('test.config', testConfigContents); } +function deleteTemporaryProjectOutput() { + if (fs.existsSync(localBaseline + "projectOutput/")) { + jake.rmRf(localBaseline + "projectOutput/"); + } +} + desc("Runs the tests using the built run.js file. Syntax is jake runtests. Optional parameters 'host=', 'tests=[regex], reporter=[list|spec|json|]'."); task("runtests", ["tests", builtLocalDirectory], function() { cleanTestDirs(); @@ -347,7 +356,7 @@ task("runtests", ["tests", builtLocalDirectory], function() { reporter = process.env.reporter || process.env.r || 'dot'; var cmd = host + " -R " + reporter + tests + colors + ' ' + run; console.log(cmd); - exec(cmd) + exec(cmd, deleteTemporaryProjectOutput); }, {async: true}); // Browser tests