Skip to content

Commit 06adba4

Browse files
committed
Cleanup temporary project output after running tests
1 parent df5c254 commit 06adba4

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ tests/cases/perf/*
1616
test-args.txt
1717
~*.docx
1818
tests/baselines/local/*
19-
tests/baselines/reference/projectOutput/
2019
tests/services/baselines/local/*
2120
tests/baselines/prototyping/local/*
2221
tests/baselines/rwc/*

Jakefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ var refRwcBaseline = "tests/baselines/rwc/reference/";
288288
desc("Builds the test infrastructure using the built compiler");
289289
task("tests", ["local", run].concat(libraryTargets));
290290

291-
function exec(cmd) {
291+
function exec(cmd, completeHandler) {
292292
var ex = jake.createExec([cmd]);
293293
// Add listeners for output and error
294294
ex.addListener("stdout", function(output) {
@@ -298,6 +298,9 @@ function exec(cmd) {
298298
process.stderr.write(error);
299299
});
300300
ex.addListener("cmdEnd", function() {
301+
if (completeHandler) {
302+
completeHandler();
303+
}
301304
complete();
302305
});
303306
try{
@@ -328,6 +331,12 @@ function writeTestConfigFile(tests, testConfigFile) {
328331
fs.writeFileSync('test.config', testConfigContents);
329332
}
330333

334+
function deleteTemporaryProjectOutput() {
335+
if (fs.existsSync(localBaseline + "projectOutput/")) {
336+
jake.rmRf(localBaseline + "projectOutput/");
337+
}
338+
}
339+
331340
desc("Runs the tests using the built run.js file. Syntax is jake runtests. Optional parameters 'host=', 'tests=[regex], reporter=[list|spec|json|<more>]'.");
332341
task("runtests", ["tests", builtLocalDirectory], function() {
333342
cleanTestDirs();
@@ -347,7 +356,7 @@ task("runtests", ["tests", builtLocalDirectory], function() {
347356
reporter = process.env.reporter || process.env.r || 'dot';
348357
var cmd = host + " -R " + reporter + tests + colors + ' ' + run;
349358
console.log(cmd);
350-
exec(cmd)
359+
exec(cmd, deleteTemporaryProjectOutput);
351360
}, {async: true});
352361

353362
// Browser tests

0 commit comments

Comments
 (0)