Skip to content

Commit a881092

Browse files
committed
Merge branch 'master' into fix-empty-object-property-access
2 parents 54edde8 + 1264951 commit a881092

File tree

499 files changed

+48585
-3051
lines changed

Some content is hidden

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

499 files changed

+48585
-3051
lines changed

Gulpfile.ts

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ import merge2 = require("merge2");
3131
import * as os from "os";
3232
import fold = require("travis-fold");
3333
const gulp = helpMaker(originalGulp);
34-
const mochaParallel = require("./scripts/mocha-parallel.js");
35-
const {runTestsInParallel} = mochaParallel;
3634

3735
Error.stackTraceLimit = 1000;
3836

@@ -668,26 +666,9 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
668666
}
669667
else {
670668
// run task to load all tests and partition them between workers
671-
const args = [];
672-
args.push("-R", "min");
673-
if (colors) {
674-
args.push("--colors");
675-
}
676-
else {
677-
args.push("--no-colors");
678-
}
679-
args.push(run);
680669
setNodeEnvToDevelopment();
681-
runTestsInParallel(taskConfigsFolder, run, { testTimeout, noColors: colors === " --no-colors " }, function(err) {
682-
// last worker clean everything and runs linter in case if there were no errors
683-
del(taskConfigsFolder).then(() => {
684-
if (!err) {
685-
lintThenFinish();
686-
}
687-
else {
688-
finish(err);
689-
}
690-
});
670+
exec(host, [run], lintThenFinish, function(e, status) {
671+
finish(e, status);
691672
});
692673
}
693674
});
@@ -711,7 +692,7 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
711692

712693
function finish(error?: any, errorStatus?: number) {
713694
restoreSavedNodeEnv();
714-
deleteTemporaryProjectOutput().then(() => {
695+
deleteTestConfig().then(deleteTemporaryProjectOutput).then(() => {
715696
if (error !== undefined || errorStatus !== undefined) {
716697
failWithStatus(error, errorStatus);
717698
}
@@ -720,6 +701,10 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
720701
}
721702
});
722703
}
704+
705+
function deleteTestConfig() {
706+
return del("test.config");
707+
}
723708
}
724709

725710
gulp.task("runtests-parallel", "Runs all the tests in parallel using the built run.js file. Optional arguments are: --t[ests]=category1|category2|... --d[ebug]=true.", ["build-rules", "tests"], (done) => {
@@ -836,7 +821,7 @@ function cleanTestDirs(done: (e?: any) => void) {
836821

837822
// used to pass data from jake command line directly to run.js
838823
function writeTestConfigFile(tests: string, light: boolean, taskConfigsFolder?: string, workerCount?: number, stackTraceLimit?: string) {
839-
const testConfigContents = JSON.stringify({ test: tests ? [tests] : undefined, light, workerCount, stackTraceLimit, taskConfigsFolder });
824+
const testConfigContents = JSON.stringify({ test: tests ? [tests] : undefined, light, workerCount, stackTraceLimit, taskConfigsFolder, noColor: !cmdLineOptions["colors"] });
840825
console.log("Running tests with config: " + testConfigContents);
841826
fs.writeFileSync("test.config", testConfigContents);
842827
}

Jakefile.js

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// This file contains the build logic for the public repo
2+
// @ts-check
23

34
var fs = require("fs");
45
var os = require("os");
56
var path = require("path");
67
var child_process = require("child_process");
78
var fold = require("travis-fold");
8-
var runTestsInParallel = require("./scripts/mocha-parallel").runTestsInParallel;
99
var ts = require("./lib/typescript");
1010

1111

@@ -38,7 +38,7 @@ else if (process.env.PATH !== undefined) {
3838

3939
function filesFromConfig(configPath) {
4040
var configText = fs.readFileSync(configPath).toString();
41-
var config = ts.parseConfigFileTextToJson(configPath, configText, /*stripComments*/ true);
41+
var config = ts.parseConfigFileTextToJson(configPath, configText);
4242
if (config.error) {
4343
throw new Error(diagnosticsToString([config.error]));
4444
}
@@ -104,6 +104,9 @@ var harnessCoreSources = [
104104
"loggedIO.ts",
105105
"rwcRunner.ts",
106106
"test262Runner.ts",
107+
"./parallel/shared.ts",
108+
"./parallel/host.ts",
109+
"./parallel/worker.ts",
107110
"runner.ts"
108111
].map(function (f) {
109112
return path.join(harnessDirectory, f);
@@ -596,7 +599,7 @@ file(typesMapOutputPath, function() {
596599
var content = fs.readFileSync(path.join(serverDirectory, 'typesMap.json'));
597600
// Validate that it's valid JSON
598601
try {
599-
JSON.parse(content);
602+
JSON.parse(content.toString());
600603
} catch (e) {
601604
console.log("Parse error in typesMap.json: " + e);
602605
}
@@ -740,7 +743,7 @@ desc("Builds the test infrastructure using the built compiler");
740743
task("tests", ["local", run].concat(libraryTargets));
741744

742745
function exec(cmd, completeHandler, errorHandler) {
743-
var ex = jake.createExec([cmd], { windowsVerbatimArguments: true });
746+
var ex = jake.createExec([cmd], { windowsVerbatimArguments: true, interactive: true });
744747
// Add listeners for output and error
745748
ex.addListener("stdout", function (output) {
746749
process.stdout.write(output);
@@ -766,15 +769,16 @@ function exec(cmd, completeHandler, errorHandler) {
766769
ex.run();
767770
}
768771

772+
const del = require("del");
769773
function cleanTestDirs() {
770774
// Clean the local baselines directory
771775
if (fs.existsSync(localBaseline)) {
772-
jake.rmRf(localBaseline);
776+
del.sync(localBaseline);
773777
}
774778

775779
// Clean the local Rwc baselines directory
776780
if (fs.existsSync(localRwcBaseline)) {
777-
jake.rmRf(localRwcBaseline);
781+
del.sync(localRwcBaseline);
778782
}
779783

780784
jake.mkdirP(localRwcBaseline);
@@ -783,13 +787,14 @@ function cleanTestDirs() {
783787
}
784788

785789
// used to pass data from jake command line directly to run.js
786-
function writeTestConfigFile(tests, light, taskConfigsFolder, workerCount, stackTraceLimit) {
790+
function writeTestConfigFile(tests, light, taskConfigsFolder, workerCount, stackTraceLimit, colors) {
787791
var testConfigContents = JSON.stringify({
788792
test: tests ? [tests] : undefined,
789793
light: light,
790794
workerCount: workerCount,
791795
taskConfigsFolder: taskConfigsFolder,
792-
stackTraceLimit: stackTraceLimit
796+
stackTraceLimit: stackTraceLimit,
797+
noColor: !colors
793798
});
794799
fs.writeFileSync('test.config', testConfigContents);
795800
}
@@ -831,7 +836,7 @@ function runConsoleTests(defaultReporter, runInParallel) {
831836
}
832837

833838
if (tests || light || taskConfigsFolder) {
834-
writeTestConfigFile(tests, light, taskConfigsFolder, workerCount, stackTraceLimit);
839+
writeTestConfigFile(tests, light, taskConfigsFolder, workerCount, stackTraceLimit, colors);
835840
}
836841

837842
if (tests && tests.toLocaleLowerCase() === "rwc") {
@@ -894,19 +899,15 @@ function runConsoleTests(defaultReporter, runInParallel) {
894899
var savedNodeEnv = process.env.NODE_ENV;
895900
process.env.NODE_ENV = "development";
896901
var startTime = mark();
897-
runTestsInParallel(taskConfigsFolder, run, { testTimeout: testTimeout, noColors: !colors }, function (err) {
902+
exec(host + " " + run, function () {
898903
process.env.NODE_ENV = savedNodeEnv;
899904
measure(startTime);
900-
// last worker clean everything and runs linter in case if there were no errors
901-
deleteTemporaryProjectOutput();
902-
jake.rmRf(taskConfigsFolder);
903-
if (err) {
904-
fail(err);
905-
}
906-
else {
907-
runLinter();
908-
complete();
909-
}
905+
runLinter();
906+
finish();
907+
}, function (e, status) {
908+
process.env.NODE_ENV = savedNodeEnv;
909+
measure(startTime);
910+
finish(status);
910911
});
911912
}
912913

@@ -969,8 +970,8 @@ desc("Runs the tests using the built run.js file like 'jake runtests'. Syntax is
969970
task("runtests-browser", ["browserify", nodeServerOutFile], function () {
970971
cleanTestDirs();
971972
host = "node";
972-
browser = process.env.browser || process.env.b || (os.platform() === "linux" ? "chrome" : "IE");
973-
tests = process.env.test || process.env.tests || process.env.t;
973+
var browser = process.env.browser || process.env.b || (os.platform() === "linux" ? "chrome" : "IE");
974+
var tests = process.env.test || process.env.tests || process.env.t;
974975
var light = process.env.light || false;
975976
var testConfigFile = 'test.config';
976977
if (fs.existsSync(testConfigFile)) {
@@ -1042,6 +1043,7 @@ function acceptBaseline(sourceFolder, targetFolder) {
10421043
if (fs.existsSync(target)) {
10431044
fs.unlinkSync(target);
10441045
}
1046+
jake.mkdirP(path.dirname(target));
10451047
fs.renameSync(path.join(sourceFolder, filename), target);
10461048
}
10471049
}

scripts/bisect-test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
/// <reference path="..\src\harness\external\node.d.ts" />
2-
1+
/**
2+
* You should have ts-node installed globally before executing this, probably!
3+
* Otherwise you'll need to compile this script before you start bisecting!
4+
*/
35
import cp = require('child_process');
46
import fs = require('fs');
57

@@ -42,8 +44,8 @@ jake.on('close', jakeExitCode => {
4244
});
4345
} else {
4446
console.log('Unknown command line arguments.');
45-
console.log('Usage (compile errors): git bisect run scripts\bisect.js "foo.ts --module amd" compiles');
46-
console.log('Usage (emit check): git bisect run scripts\bisect.js bar.ts emits bar.js "_this = this"');
47+
console.log('Usage (compile errors): git bisect run ts-node scripts\bisect-test.ts "../failure.ts --module amd" !compiles');
48+
console.log('Usage (emit check): git bisect run ts-node scripts\bisect-test.ts bar.ts emits bar.js "_this = this"');
4749
// Aborts the 'git bisect run' process
4850
process.exit(-1);
4951
}

scripts/bisect.cmd

Lines changed: 0 additions & 30 deletions
This file was deleted.

scripts/mocha-none-reporter.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)