Skip to content

Commit 86a6959

Browse files
committed
Merge branch 'master' into primitive-type-guards-are-order-independent
2 parents a1e4b31 + a4991b9 commit 86a6959

File tree

76 files changed

+4245
-615
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+4245
-615
lines changed

Jakefile.js

Lines changed: 14 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ var os = require("os");
55
var path = require("path");
66
var child_process = require("child_process");
77
var Linter = require("tslint");
8+
var runTestsInParallel = require("./scripts/mocha-parallel").runTestsInParallel;
89

910
// Variables
1011
var compilerDirectory = "src/compiler/";
@@ -312,10 +313,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
312313
}
313314

314315
if (useDebugMode) {
315-
options += " -sourcemap";
316-
if (!opts.noMapRoot) {
317-
options += " -mapRoot file:///" + path.resolve(path.dirname(outFile));
318-
}
316+
options += " --inlineSourceMap --inlineSources";
319317
} else {
320318
options += " --newLine LF";
321319
}
@@ -485,7 +483,6 @@ var tscFile = path.join(builtLocalDirectory, compilerFilename);
485483
compileFile(tscFile, compilerSources, [builtLocalDirectory, copyright].concat(compilerSources), [copyright], /*useBuiltCompiler:*/ false);
486484

487485
var servicesFile = path.join(builtLocalDirectory, "typescriptServices.js");
488-
var servicesFileInBrowserTest = path.join(builtLocalDirectory, "typescriptServicesInBrowserTest.js");
489486
var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
490487
var nodePackageFile = path.join(builtLocalDirectory, "typescript.js");
491488
var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
@@ -517,16 +514,6 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
517514
fs.writeFileSync(nodeStandaloneDefinitionsFile, nodeStandaloneDefinitionsFileContents);
518515
});
519516

520-
compileFile(servicesFileInBrowserTest, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources),
521-
/*prefixes*/ [copyright],
522-
/*useBuiltCompiler*/ true,
523-
{ noOutFile: false, generateDeclarations: true, preserveConstEnums: true, keepComments: true, noResolve: false, stripInternal: true, noMapRoot: true },
524-
/*callback*/ function () {
525-
var content = fs.readFileSync(servicesFileInBrowserTest).toString();
526-
var i = content.lastIndexOf("\n");
527-
fs.writeFileSync(servicesFileInBrowserTest, content.substring(0, i) + "\r\n//# sourceURL=../built/local/typeScriptServices.js" + content.substring(i));
528-
});
529-
530517

531518
var serverFile = path.join(builtLocalDirectory, "tsserver.js");
532519
compileFile(serverFile, serverSources,[builtLocalDirectory, copyright].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true);
@@ -688,7 +675,6 @@ function cleanTestDirs() {
688675
// used to pass data from jake command line directly to run.js
689676
function writeTestConfigFile(tests, light, taskConfigsFolder, workerCount) {
690677
var testConfigContents = JSON.stringify({ test: tests ? [tests] : undefined, light: light, workerCount: workerCount, taskConfigsFolder: taskConfigsFolder });
691-
console.log('Running tests with config: ' + testConfigContents);
692678
fs.writeFileSync('test.config', testConfigContents);
693679
}
694680

@@ -749,42 +735,16 @@ function runConsoleTests(defaultReporter, runInParallel) {
749735

750736
}
751737
else {
752-
// run task to load all tests and partition them between workers
753-
var cmd = "mocha " + " -R min " + colors + run;
754-
console.log(cmd);
755-
exec(cmd, function() {
756-
// read all configuration files and spawn a worker for every config
757-
var configFiles = fs.readdirSync(taskConfigsFolder);
758-
var counter = configFiles.length;
759-
var firstErrorStatus;
760-
// schedule work for chunks
761-
configFiles.forEach(function (f) {
762-
var configPath = path.join(taskConfigsFolder, f);
763-
var workerCmd = "mocha" + " -t " + testTimeout + " -R " + reporter + " " + colors + " " + run + " --config='" + configPath + "'";
764-
console.log(workerCmd);
765-
exec(workerCmd, finishWorker, finishWorker)
766-
});
767-
768-
function finishWorker(e, errorStatus) {
769-
counter--;
770-
if (firstErrorStatus === undefined && errorStatus !== undefined) {
771-
firstErrorStatus = errorStatus;
772-
}
773-
if (counter !== 0) {
774-
complete();
775-
}
776-
else {
777-
// last worker clean everything and runs linter in case if there were no errors
778-
deleteTemporaryProjectOutput();
779-
jake.rmRf(taskConfigsFolder);
780-
if (firstErrorStatus === undefined) {
781-
runLinter();
782-
complete();
783-
}
784-
else {
785-
failWithStatus(firstErrorStatus);
786-
}
787-
}
738+
runTestsInParallel(taskConfigsFolder, run, { testTimeout: testTimeout, noColors: colors === " --no-colors " }, function (err) {
739+
// last worker clean everything and runs linter in case if there were no errors
740+
deleteTemporaryProjectOutput();
741+
jake.rmRf(taskConfigsFolder);
742+
if (err) {
743+
fail(err);
744+
}
745+
else {
746+
runLinter();
747+
complete();
788748
}
789749
});
790750
}
@@ -839,12 +799,12 @@ compileFile(nodeServerOutFile, [nodeServerInFile], [builtLocalDirectory, tscFile
839799

840800
desc("Runs browserify on run.js to produce a file suitable for running tests in the browser");
841801
task("browserify", ["tests", builtLocalDirectory, nodeServerOutFile], function() {
842-
var cmd = 'browserify built/local/run.js -o built/local/bundle.js';
802+
var cmd = 'browserify built/local/run.js -d -o built/local/bundle.js';
843803
exec(cmd);
844804
}, {async: true});
845805

846806
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]");
847-
task("runtests-browser", ["tests", "browserify", builtLocalDirectory, servicesFileInBrowserTest], function() {
807+
task("runtests-browser", ["tests", "browserify", builtLocalDirectory, servicesFile], function() {
848808
cleanTestDirs();
849809
host = "node";
850810
port = process.env.port || process.env.p || '8888';

scripts/mocha-none-reporter.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Module dependencies.
3+
*/
4+
5+
var Base = require('mocha').reporters.Base;
6+
7+
/**
8+
* Expose `None`.
9+
*/
10+
11+
exports = module.exports = None;
12+
13+
/**
14+
* Initialize a new `None` test reporter.
15+
*
16+
* @api public
17+
* @param {Runner} runner
18+
*/
19+
function None(runner) {
20+
Base.call(this);
21+
}
22+
23+
/**
24+
* Inherit from `Base.prototype`.
25+
*/
26+
None.prototype.__proto__ = Base.prototype;

0 commit comments

Comments
 (0)