Cleanup temporary project output after running tests

This commit is contained in:
Sheetal Nandi 2014-07-17 12:32:51 -07:00
parent df5c2547fa
commit 06adba4fdd
2 changed files with 11 additions and 3 deletions

1
.gitignore vendored
View file

@ -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/*

View file

@ -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|<more>]'.");
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