Skip to content

Commit 2c7c5bc

Browse files
committed
Merge pull request microsoft#5083 from weswigham/lint-on-runtests
linter runs after tests via jake
2 parents c7fdc0a + ba2024f commit 2c7c5bc

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

Jakefile.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -628,10 +628,9 @@ function deleteTemporaryProjectOutput() {
628628

629629
var testTimeout = 20000;
630630
desc("Runs the tests using the built run.js file. Syntax is jake runtests. Optional parameters 'host=', 'tests=[regex], reporter=[list|spec|json|<more>]', debug=true.");
631-
task("runtests", ["tests", builtLocalDirectory], function() {
631+
task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
632632
cleanTestDirs();
633633
var debug = process.env.debug || process.env.d;
634-
host = "mocha"
635634
tests = process.env.test || process.env.tests || process.env.t;
636635
var light = process.env.light || false;
637636
var testConfigFile = 'test.config';
@@ -653,9 +652,16 @@ task("runtests", ["tests", builtLocalDirectory], function() {
653652
reporter = process.env.reporter || process.env.r || 'mocha-fivemat-progress-reporter';
654653
// timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally
655654
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
656-
var cmd = host + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run;
655+
var cmd = "mocha" + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run;
657656
console.log(cmd);
658-
exec(cmd, deleteTemporaryProjectOutput);
657+
exec(cmd, function() {
658+
deleteTemporaryProjectOutput();
659+
var lint = jake.Task['lint'];
660+
lint.addListener('complete', function () {
661+
complete();
662+
});
663+
lint.invoke();
664+
});
659665
}, {async: true});
660666

661667
desc("Generates code coverage data via instanbul");
@@ -825,7 +831,7 @@ var tslintRulesOutFiles = tslintRules.map(function(p) {
825831
desc("Compiles tslint rules to js");
826832
task("build-rules", tslintRulesOutFiles);
827833
tslintRulesFiles.forEach(function(ruleFile, i) {
828-
compileFile(tslintRulesOutFiles[i], [ruleFile], [ruleFile], [], /*useBuiltCompiler*/ true, /*noOutFile*/ true, /*generateDeclarations*/ false, path.join(builtLocalDirectory, "tslint"));
834+
compileFile(tslintRulesOutFiles[i], [ruleFile], [ruleFile], [], /*useBuiltCompiler*/ false, /*noOutFile*/ true, /*generateDeclarations*/ false, path.join(builtLocalDirectory, "tslint"));
829835
});
830836

831837
function getLinterOptions() {
@@ -859,8 +865,6 @@ function lintFileAsync(options, path, cb) {
859865

860866
var lintTargets = compilerSources.concat(harnessCoreSources);
861867

862-
// if the codebase were free of linter errors we could make jake runtests
863-
// run this task automatically
864868
desc("Runs tslint on the compiler sources");
865869
task("lint", ["build-rules"], function() {
866870
var lintOptions = getLinterOptions();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
},
4141
"scripts": {
4242
"pretest": "jake tests",
43-
"test": "jake runtests && npm run lint",
43+
"test": "jake runtests",
4444
"build": "npm run build:compiler && npm run build:tests",
4545
"build:compiler": "jake local",
4646
"build:tests": "jake tests",

0 commit comments

Comments
 (0)