Skip to content

Commit dd8ea15

Browse files
author
jbondc
committed
If there's a callback, make it its responsibility to call complete()
1 parent 9ee494a commit dd8ea15

1 file changed

Lines changed: 13 additions & 23 deletions

File tree

Jakefile

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu
244244

245245
if (callback) {
246246
callback();
247+
} else {
248+
complete();
247249
}
248-
249-
complete();
250250
});
251251
ex.addListener("error", function() {
252252
fs.unlinkSync(outFile);
@@ -359,6 +359,7 @@ compileFile(nodeDefinitionsFile, servicesSources,[builtLocalDirectory, copyright
359359

360360
// Delete the temp dir
361361
jake.rmRf(tempDirPath, {silent: true});
362+
complete();
362363
});
363364

364365
// Local target to build the compiler and services
@@ -405,9 +406,7 @@ file(specMd, [word2mdJs, specWord], function () {
405406
var specWordFullPath = path.resolve(specWord);
406407
var cmd = "cscript //nologo " + word2mdJs + ' "' + specWordFullPath + '" ' + specMd;
407408

408-
exec(cmd, function () {
409-
complete();
410-
});
409+
exec(cmd);
411410
}, {async: true})
412411

413412

@@ -464,6 +463,8 @@ function exec(cmd, completeHandler) {
464463
ex.addListener("cmdEnd", function() {
465464
if (completeHandler) {
466465
completeHandler();
466+
} else {
467+
complete();
467468
}
468469
});
469470
ex.addListener("error", function(e, status) {
@@ -500,6 +501,7 @@ function deleteTemporaryProjectOutput() {
500501
if (fs.existsSync(path.join(localBaseline, "projectOutput/"))) {
501502
jake.rmRf(path.join(localBaseline, "projectOutput/"));
502503
}
504+
complete();
503505
}
504506

505507
var testTimeout = 20000;
@@ -536,9 +538,7 @@ desc("Generates code coverage data via instanbul")
536538
task("generate-code-coverage", ["tests", builtLocalDirectory], function () {
537539
var cmd = 'istanbul cover node_modules/mocha/bin/_mocha -- -R min -t ' + testTimeout + ' ' + run;
538540

539-
exec(cmd, function(){
540-
complete();
541-
});
541+
exec(cmd);
542542
}, { async: true });
543543

544544
// Browser tests
@@ -549,9 +549,7 @@ compileFile(nodeServerOutFile, [nodeServerInFile], [builtLocalDirectory, tscFile
549549
desc("Runs browserify on run.js to produce a file suitable for running tests in the browser");
550550
task("browserify", ["tests", builtLocalDirectory, nodeServerOutFile], function() {
551551
var cmd = 'browserify built/local/run.js -o built/local/bundle.js';
552-
exec(cmd, function(){
553-
complete();
554-
});
552+
exec(cmd);
555553
}, {async: true});
556554

557555
desc("Runs the tests using the built run.js file like 'jake runtests'. Syntax is jake runtests-browser. Additional optional parameters tests=[regex], port=, browser=[chrome|IE]");
@@ -571,9 +569,7 @@ task("runtests-browser", ["tests", "browserify", builtLocalDirectory], function(
571569

572570
tests = tests ? tests : '';
573571
var cmd = host + " tests/webTestServer.js " + port + " " + browser + " " + tests
574-
exec(cmd, function(){
575-
complete();
576-
});
572+
exec(cmd);
577573
}, {async: true});
578574

579575
function getDiffTool() {
@@ -588,17 +584,13 @@ function getDiffTool() {
588584
desc("Diffs the compiler baselines using the diff tool specified by the 'DIFF' environment variable");
589585
task('diff', function () {
590586
var cmd = '"' + getDiffTool() + '" ' + refBaseline + ' ' + localBaseline;
591-
exec(cmd, function(){
592-
complete();
593-
});
587+
exec(cmd);
594588
}, {async: true});
595589

596590
desc("Diffs the RWC baselines using the diff tool specified by the 'DIFF' environment variable");
597591
task('diff-rwc', function () {
598592
var cmd = '"' + getDiffTool() + '" ' + refRwcBaseline + ' ' + localRwcBaseline;
599-
exec(cmd, function(){
600-
complete();
601-
});
593+
exec(cmd);
602594
}, {async: true});
603595

604596
desc("Builds the test sources and automation in debug mode");
@@ -668,7 +660,5 @@ desc("Builds an instrumented tsc.js");
668660
task('tsc-instrumented', [loggedIOJsPath, instrumenterJsPath, tscFile], function() {
669661
var cmd = host + ' ' + instrumenterJsPath + ' record iocapture ' + builtLocalDirectory + compilerFilename;
670662

671-
exec(cmd, function() {
672-
complete();
673-
});
663+
exec(cmd);
674664
}, { async: true });

0 commit comments

Comments
 (0)