|
1 | 1 | // This file contains the build logic for the public repo
|
| 2 | +// @ts-check |
2 | 3 |
|
3 | 4 | var fs = require("fs");
|
4 | 5 | var os = require("os");
|
5 | 6 | var path = require("path");
|
6 | 7 | var child_process = require("child_process");
|
7 | 8 | var fold = require("travis-fold");
|
8 |
| -var runTestsInParallel = require("./scripts/mocha-parallel").runTestsInParallel; |
9 | 9 | var ts = require("./lib/typescript");
|
10 | 10 |
|
11 | 11 |
|
@@ -38,7 +38,7 @@ else if (process.env.PATH !== undefined) {
|
38 | 38 |
|
39 | 39 | function filesFromConfig(configPath) {
|
40 | 40 | var configText = fs.readFileSync(configPath).toString();
|
41 |
| - var config = ts.parseConfigFileTextToJson(configPath, configText, /*stripComments*/ true); |
| 41 | + var config = ts.parseConfigFileTextToJson(configPath, configText); |
42 | 42 | if (config.error) {
|
43 | 43 | throw new Error(diagnosticsToString([config.error]));
|
44 | 44 | }
|
@@ -104,6 +104,9 @@ var harnessCoreSources = [
|
104 | 104 | "loggedIO.ts",
|
105 | 105 | "rwcRunner.ts",
|
106 | 106 | "test262Runner.ts",
|
| 107 | + "./parallel/shared.ts", |
| 108 | + "./parallel/host.ts", |
| 109 | + "./parallel/worker.ts", |
107 | 110 | "runner.ts"
|
108 | 111 | ].map(function (f) {
|
109 | 112 | return path.join(harnessDirectory, f);
|
@@ -596,7 +599,7 @@ file(typesMapOutputPath, function() {
|
596 | 599 | var content = fs.readFileSync(path.join(serverDirectory, 'typesMap.json'));
|
597 | 600 | // Validate that it's valid JSON
|
598 | 601 | try {
|
599 |
| - JSON.parse(content); |
| 602 | + JSON.parse(content.toString()); |
600 | 603 | } catch (e) {
|
601 | 604 | console.log("Parse error in typesMap.json: " + e);
|
602 | 605 | }
|
@@ -740,7 +743,7 @@ desc("Builds the test infrastructure using the built compiler");
|
740 | 743 | task("tests", ["local", run].concat(libraryTargets));
|
741 | 744 |
|
742 | 745 | function exec(cmd, completeHandler, errorHandler) {
|
743 |
| - var ex = jake.createExec([cmd], { windowsVerbatimArguments: true }); |
| 746 | + var ex = jake.createExec([cmd], { windowsVerbatimArguments: true, interactive: true }); |
744 | 747 | // Add listeners for output and error
|
745 | 748 | ex.addListener("stdout", function (output) {
|
746 | 749 | process.stdout.write(output);
|
@@ -783,13 +786,14 @@ function cleanTestDirs() {
|
783 | 786 | }
|
784 | 787 |
|
785 | 788 | // used to pass data from jake command line directly to run.js
|
786 |
| -function writeTestConfigFile(tests, light, taskConfigsFolder, workerCount, stackTraceLimit) { |
| 789 | +function writeTestConfigFile(tests, light, taskConfigsFolder, workerCount, stackTraceLimit, colors) { |
787 | 790 | var testConfigContents = JSON.stringify({
|
788 | 791 | test: tests ? [tests] : undefined,
|
789 | 792 | light: light,
|
790 | 793 | workerCount: workerCount,
|
791 | 794 | taskConfigsFolder: taskConfigsFolder,
|
792 |
| - stackTraceLimit: stackTraceLimit |
| 795 | + stackTraceLimit: stackTraceLimit, |
| 796 | + noColor: !colors |
793 | 797 | });
|
794 | 798 | fs.writeFileSync('test.config', testConfigContents);
|
795 | 799 | }
|
@@ -831,7 +835,7 @@ function runConsoleTests(defaultReporter, runInParallel) {
|
831 | 835 | }
|
832 | 836 |
|
833 | 837 | if (tests || light || taskConfigsFolder) {
|
834 |
| - writeTestConfigFile(tests, light, taskConfigsFolder, workerCount, stackTraceLimit); |
| 838 | + writeTestConfigFile(tests, light, taskConfigsFolder, workerCount, stackTraceLimit, colors); |
835 | 839 | }
|
836 | 840 |
|
837 | 841 | if (tests && tests.toLocaleLowerCase() === "rwc") {
|
@@ -894,19 +898,15 @@ function runConsoleTests(defaultReporter, runInParallel) {
|
894 | 898 | var savedNodeEnv = process.env.NODE_ENV;
|
895 | 899 | process.env.NODE_ENV = "development";
|
896 | 900 | var startTime = mark();
|
897 |
| - runTestsInParallel(taskConfigsFolder, run, { testTimeout: testTimeout, noColors: !colors }, function (err) { |
| 901 | + exec(host + " " + run, function () { |
898 | 902 | process.env.NODE_ENV = savedNodeEnv;
|
899 | 903 | 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 |
| - } |
| 904 | + runLinter(); |
| 905 | + finish(); |
| 906 | + }, function (e, status) { |
| 907 | + process.env.NODE_ENV = savedNodeEnv; |
| 908 | + measure(startTime); |
| 909 | + finish(status); |
910 | 910 | });
|
911 | 911 | }
|
912 | 912 |
|
@@ -969,8 +969,8 @@ desc("Runs the tests using the built run.js file like 'jake runtests'. Syntax is
|
969 | 969 | task("runtests-browser", ["browserify", nodeServerOutFile], function () {
|
970 | 970 | cleanTestDirs();
|
971 | 971 | 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; |
| 972 | + var browser = process.env.browser || process.env.b || (os.platform() === "linux" ? "chrome" : "IE"); |
| 973 | + var tests = process.env.test || process.env.tests || process.env.t; |
974 | 974 | var light = process.env.light || false;
|
975 | 975 | var testConfigFile = 'test.config';
|
976 | 976 | if (fs.existsSync(testConfigFile)) {
|
|
0 commit comments