Skip to content

Commit b043edd

Browse files
committed
Merge
2 parents 0e105ad + 90ae9ff commit b043edd

File tree

764 files changed

+18681
-6068
lines changed

Some content is hidden

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

764 files changed

+18681
-6068
lines changed

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,11 @@ internal/
5959
.idea
6060
yarn.lock
6161
.parallelperf.*
62+
tests/cases/user/*/package-lock.json
63+
tests/cases/user/*/node_modules/
64+
tests/cases/user/*/**/*.js
65+
tests/cases/user/*/**/*.js.map
66+
tests/cases/user/*/**/*.d.ts
67+
!tests/cases/user/zone.js/
68+
!tests/cases/user/bignumber.js/
69+
!tests/cases/user/discord.js/

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ language: node_js
22

33
node_js:
44
- 'stable'
5+
- '8'
56
- '6'
6-
- '4'
77

88
sudo: false
99

Gulpfile.ts

+51-59
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,15 @@ const cmdLineOptions = minimist(process.argv.slice(2), {
4646
boolean: ["debug", "inspect", "light", "colors", "lint", "soft"],
4747
string: ["browser", "tests", "host", "reporter", "stackTraceLimit", "timeout"],
4848
alias: {
49-
b: "browser",
50-
d: "debug", "debug-brk": "debug",
51-
i: "inspect", "inspect-brk": "inspect",
52-
t: "tests", test: "tests",
53-
r: "reporter",
54-
c: "colors", color: "colors",
55-
f: "files", file: "files",
56-
w: "workers",
49+
"b": "browser",
50+
"d": "debug", "debug-brk": "debug",
51+
"i": "inspect", "inspect-brk": "inspect",
52+
"t": "tests", "test": "tests",
53+
"ru": "runners", "runner": "runners",
54+
"r": "reporter",
55+
"c": "colors", "color": "colors",
56+
"f": "files", "file": "files",
57+
"w": "workers",
5758
},
5859
default: {
5960
soft: false,
@@ -64,6 +65,7 @@ const cmdLineOptions = minimist(process.argv.slice(2), {
6465
browser: process.env.browser || process.env.b || "IE",
6566
timeout: process.env.timeout || 40000,
6667
tests: process.env.test || process.env.tests || process.env.t,
68+
runners: process.env.runners || process.env.runner || process.env.ru,
6769
light: process.env.light === undefined || process.env.light !== "false",
6870
reporter: process.env.reporter || process.env.r,
6971
lint: process.env.lint || true,
@@ -72,7 +74,8 @@ const cmdLineOptions = minimist(process.argv.slice(2), {
7274
}
7375
});
7476

75-
function exec(cmd: string, args: string[], complete: () => void = (() => { }), error: (e: any, status: number) => void = (() => { })) {
77+
const noop = () => {}; // tslint:disable-line no-empty
78+
function exec(cmd: string, args: string[], complete: () => void = noop, error: (e: any, status: number) => void = noop) {
7679
console.log(`${cmd} ${args.join(" ")}`);
7780
// TODO (weswig): Update child_process types to add windowsVerbatimArguments to the type definition
7881
const subshellFlag = isWin ? "/c" : "-c";
@@ -99,12 +102,12 @@ const lclDirectory = "src/loc/lcl";
99102

100103
const builtDirectory = "built/";
101104
const builtLocalDirectory = "built/local/";
102-
const LKGDirectory = "lib/";
105+
const lkgDirectory = "lib/";
103106

104107
const copyright = "CopyrightNotice.txt";
105108

106109
const compilerFilename = "tsc.js";
107-
const LKGCompiler = path.join(LKGDirectory, compilerFilename);
110+
const lkgCompiler = path.join(lkgDirectory, compilerFilename);
108111
const builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename);
109112

110113
const nodeModulesPathPrefix = path.resolve("./node_modules/.bin/");
@@ -123,34 +126,31 @@ const es2015LibrarySources = [
123126
"es2015.symbol.wellknown.d.ts"
124127
];
125128

126-
const es2015LibrarySourceMap = es2015LibrarySources.map(function(source) {
127-
return { target: "lib." + source, sources: ["header.d.ts", source] };
128-
});
129+
const es2015LibrarySourceMap = es2015LibrarySources.map(source =>
130+
({ target: "lib." + source, sources: ["header.d.ts", source] }));
129131

130132
const es2016LibrarySource = ["es2016.array.include.d.ts"];
131133

132-
const es2016LibrarySourceMap = es2016LibrarySource.map(function(source) {
133-
return { target: "lib." + source, sources: ["header.d.ts", source] };
134-
});
134+
const es2016LibrarySourceMap = es2016LibrarySource.map(source =>
135+
({ target: "lib." + source, sources: ["header.d.ts", source] }));
135136

136137
const es2017LibrarySource = [
137138
"es2017.object.d.ts",
138139
"es2017.sharedmemory.d.ts",
139140
"es2017.string.d.ts",
140141
"es2017.intl.d.ts",
142+
"es2017.typedarrays.d.ts",
141143
];
142144

143-
const es2017LibrarySourceMap = es2017LibrarySource.map(function(source) {
144-
return { target: "lib." + source, sources: ["header.d.ts", source] };
145-
});
145+
const es2017LibrarySourceMap = es2017LibrarySource.map(source =>
146+
({ target: "lib." + source, sources: ["header.d.ts", source] }));
146147

147148
const esnextLibrarySource = [
148149
"esnext.asynciterable.d.ts"
149150
];
150151

151-
const esnextLibrarySourceMap = esnextLibrarySource.map(function (source) {
152-
return { target: "lib." + source, sources: ["header.d.ts", source] };
153-
});
152+
const esnextLibrarySourceMap = esnextLibrarySource.map(source =>
153+
({ target: "lib." + source, sources: ["header.d.ts", source] }));
154154

155155
const hostsLibrarySources = ["dom.generated.d.ts", "webworker.importscripts.d.ts", "scripthost.d.ts"];
156156

@@ -171,14 +171,13 @@ const librarySourceMap = [
171171
// JavaScript + all host library
172172
{ target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources) },
173173
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") },
174-
{ target: "lib.es2016.full.d.ts", sources: ["header.d.ts", "es2016.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") },
175-
{ target: "lib.es2017.full.d.ts", sources: ["header.d.ts", "es2017.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") },
176-
{ target: "lib.esnext.full.d.ts", sources: ["header.d.ts", "esnext.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") },
174+
{ target: "lib.es2016.full.d.ts", sources: ["header.d.ts", "es2016.d.ts"].concat(hostsLibrarySources, "dom.iterable.d.ts") },
175+
{ target: "lib.es2017.full.d.ts", sources: ["header.d.ts", "es2017.d.ts"].concat(hostsLibrarySources, "dom.iterable.d.ts") },
176+
{ target: "lib.esnext.full.d.ts", sources: ["header.d.ts", "esnext.d.ts"].concat(hostsLibrarySources, "dom.iterable.d.ts") },
177177
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap, esnextLibrarySourceMap);
178178

179-
const libraryTargets = librarySourceMap.map(function(f) {
180-
return path.join(builtLocalDirectory, f.target);
181-
});
179+
const libraryTargets = librarySourceMap.map(f =>
180+
path.join(builtLocalDirectory, f.target));
182181

183182
/**
184183
* .lcg file is what localization team uses to know what messages to localize.
@@ -193,22 +192,19 @@ const generatedLCGFile = path.join(builtLocalDirectory, "enu", "diagnosticMessag
193192
* 2. 'src\compiler\diagnosticMessages.generated.json' => 'built\local\ENU\diagnosticMessages.generated.json.lcg'
194193
* generate the lcg file (source of messages to localize) from the diagnosticMessages.generated.json
195194
*/
196-
const localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-CN", "zh-TW"].map(function (f) {
197-
return path.join(builtLocalDirectory, f, "diagnosticMessages.generated.json");
198-
}).concat(generatedLCGFile);
195+
const localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-CN", "zh-TW"]
196+
.map(f => path.join(builtLocalDirectory, f, "diagnosticMessages.generated.json"))
197+
.concat(generatedLCGFile);
199198

200199
for (const i in libraryTargets) {
201200
const entry = librarySourceMap[i];
202201
const target = libraryTargets[i];
203-
const sources = [copyright].concat(entry.sources.map(function(s) {
204-
return path.join(libraryDirectory, s);
205-
}));
206-
gulp.task(target, /*help*/ false, [], function() {
207-
return gulp.src(sources)
202+
const sources = [copyright].concat(entry.sources.map(s => path.join(libraryDirectory, s)));
203+
gulp.task(target, /*help*/ false, [], () =>
204+
gulp.src(sources)
208205
.pipe(newer(target))
209206
.pipe(concat(target, { newLine: "\n\n" }))
210-
.pipe(gulp.dest("."));
211-
});
207+
.pipe(gulp.dest(".")));
212208
}
213209

214210
const configureNightlyJs = path.join(scriptsDirectory, "configureNightly.js");
@@ -575,9 +571,7 @@ gulp.task(specMd, /*help*/ false, [word2mdJs], (done) => {
575571
const specMDFullPath = path.resolve(specMd);
576572
const cmd = "cscript //nologo " + word2mdJs + " \"" + specWordFullPath + "\" " + "\"" + specMDFullPath + "\"";
577573
console.log(cmd);
578-
cp.exec(cmd, function() {
579-
done();
580-
});
574+
cp.exec(cmd, done);
581575
});
582576

583577
gulp.task("generate-spec", "Generates a Markdown version of the Language Specification", [specMd]);
@@ -599,7 +593,7 @@ gulp.task("VerifyLKG", /*help*/ false, [], () => {
599593
". The following files are missing:\n" + missingFiles.join("\n"));
600594
}
601595
// Copy all the targets into the LKG directory
602-
return gulp.src([...expectedFiles, path.join(builtLocalDirectory, "**"), `!${path.join(builtLocalDirectory, "tslint")}`, `!${path.join(builtLocalDirectory, "*.*")}`]).pipe(gulp.dest(LKGDirectory));
596+
return gulp.src([...expectedFiles, path.join(builtLocalDirectory, "**"), `!${path.join(builtLocalDirectory, "tslint")}`, `!${path.join(builtLocalDirectory, "*.*")}`]).pipe(gulp.dest(lkgDirectory));
603597
});
604598

605599
gulp.task("LKGInternal", /*help*/ false, ["lib", "local"]);
@@ -658,6 +652,7 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
658652
const debug = cmdLineOptions.debug;
659653
const inspect = cmdLineOptions.inspect;
660654
const tests = cmdLineOptions.tests;
655+
const runners = cmdLineOptions.runners;
661656
const light = cmdLineOptions.light;
662657
const stackTraceLimit = cmdLineOptions.stackTraceLimit;
663658
const testConfigFile = "test.config";
@@ -678,8 +673,8 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
678673
workerCount = cmdLineOptions.workers;
679674
}
680675

681-
if (tests || light || taskConfigsFolder) {
682-
writeTestConfigFile(tests, light, taskConfigsFolder, workerCount, stackTraceLimit);
676+
if (tests || runners || light || taskConfigsFolder) {
677+
writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit);
683678
}
684679

685680
if (tests && tests.toLocaleLowerCase() === "rwc") {
@@ -714,17 +709,13 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
714709
}
715710
args.push(run);
716711
setNodeEnvToDevelopment();
717-
exec(mocha, args, lintThenFinish, function(e, status) {
718-
finish(e, status);
719-
});
712+
exec(mocha, args, lintThenFinish, finish);
720713

721714
}
722715
else {
723716
// run task to load all tests and partition them between workers
724717
setNodeEnvToDevelopment();
725-
exec(host, [run], lintThenFinish, function(e, status) {
726-
finish(e, status);
727-
});
718+
exec(host, [run], lintThenFinish, finish);
728719
}
729720
});
730721

@@ -874,8 +865,8 @@ function cleanTestDirs(done: (e?: any) => void) {
874865
}
875866

876867
// used to pass data from jake command line directly to run.js
877-
function writeTestConfigFile(tests: string, light: boolean, taskConfigsFolder?: string, workerCount?: number, stackTraceLimit?: string) {
878-
const testConfigContents = JSON.stringify({ test: tests ? [tests] : undefined, light, workerCount, stackTraceLimit, taskConfigsFolder, noColor: !cmdLineOptions.colors });
868+
function writeTestConfigFile(tests: string, runners: string, light: boolean, taskConfigsFolder?: string, workerCount?: number, stackTraceLimit?: string) {
869+
const testConfigContents = JSON.stringify({ test: tests ? [tests] : undefined, runner: runners ? runners.split(",") : undefined, light, workerCount, stackTraceLimit, taskConfigsFolder, noColor: !cmdLineOptions.colors });
879870
console.log("Running tests with config: " + testConfigContents);
880871
fs.writeFileSync("test.config", testConfigContents);
881872
}
@@ -886,13 +877,14 @@ gulp.task("runtests-browser", "Runs the tests using the built run.js file like '
886877
if (err) { console.error(err); done(err); process.exit(1); }
887878
host = "node";
888879
const tests = cmdLineOptions.tests;
880+
const runners = cmdLineOptions.runners;
889881
const light = cmdLineOptions.light;
890882
const testConfigFile = "test.config";
891883
if (fs.existsSync(testConfigFile)) {
892884
fs.unlinkSync(testConfigFile);
893885
}
894-
if (tests || light) {
895-
writeTestConfigFile(tests, light);
886+
if (tests || runners || light) {
887+
writeTestConfigFile(tests, runners, light);
896888
}
897889

898890
const args = [nodeServerOutFile];
@@ -1006,7 +998,7 @@ gulp.task(loggedIOJsPath, /*help*/ false, [], (done) => {
1006998
const temp = path.join(builtLocalDirectory, "temp");
1007999
mkdirP(temp, (err) => {
10081000
if (err) { console.error(err); done(err); process.exit(1); }
1009-
exec(host, [LKGCompiler, "--types", "--target es5", "--lib es5", "--outdir", temp, loggedIOpath], () => {
1001+
exec(host, [lkgCompiler, "--types", "--target es5", "--lib es5", "--outdir", temp, loggedIOpath], () => {
10101002
fs.renameSync(path.join(temp, "/harness/loggedIO.js"), loggedIOJsPath);
10111003
del(temp).then(() => done(), done);
10121004
}, done);
@@ -1043,7 +1035,7 @@ gulp.task("update-sublime", "Updates the sublime plugin's tsserver", ["local", s
10431035
});
10441036

10451037
gulp.task("build-rules", "Compiles tslint rules to js", () => {
1046-
const settings: tsc.Settings = getCompilerSettings({ module: "commonjs", "lib": ["es6"] }, /*useBuiltCompiler*/ false);
1038+
const settings: tsc.Settings = getCompilerSettings({ module: "commonjs", lib: ["es6"] }, /*useBuiltCompiler*/ false);
10471039
const dest = path.join(builtLocalDirectory, "tslint");
10481040
return gulp.src("scripts/tslint/**/*.ts")
10491041
.pipe(newer({
@@ -1082,7 +1074,7 @@ function sendNextFile(files: {path: string}[], child: cp.ChildProcess, callback:
10821074
function spawnLintWorker(files: {path: string}[], callback: (failures: number) => void) {
10831075
const child = cp.fork("./scripts/parallel-lint");
10841076
let failures = 0;
1085-
child.on("message", function(data) {
1077+
child.on("message", data => {
10861078
switch (data.kind) {
10871079
case "result":
10881080
if (data.failures > 0) {
@@ -1106,7 +1098,7 @@ gulp.task("lint", "Runs tslint on the compiler sources. Optional arguments are:
11061098
const fileMatcher = cmdLineOptions.files;
11071099
const files = fileMatcher
11081100
? `src/**/${fileMatcher}`
1109-
: "Gulpfile.ts 'scripts/generateLocalizedDiagnosticMessages.ts' 'scripts/tslint/**/*.ts' 'src/**/*.ts' --exclude src/lib/es5.d.ts --exclude 'src/lib/*.generated.d.ts'";
1101+
: "Gulpfile.ts 'scripts/generateLocalizedDiagnosticMessages.ts' 'scripts/tslint/**/*.ts' 'src/**/*.ts' --exclude 'src/lib/*.d.ts'";
11101102
const cmd = `node node_modules/tslint/bin/tslint ${files} --formatters-dir ./built/local/tslint/formatters --format autolinkableStylish`;
11111103
console.log("Linting: " + cmd);
11121104
child_process.execSync(cmd, { stdio: [0, 1, 2] });

Jakefile.js

+12-7
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ var harnessCoreSources = [
105105
"projectsRunner.ts",
106106
"loggedIO.ts",
107107
"rwcRunner.ts",
108+
"externalCompileRunner.ts",
108109
"test262Runner.ts",
109110
"./parallel/shared.ts",
110111
"./parallel/host.ts",
@@ -196,7 +197,8 @@ var es2017LibrarySource = [
196197
"es2017.object.d.ts",
197198
"es2017.sharedmemory.d.ts",
198199
"es2017.string.d.ts",
199-
"es2017.intl.d.ts"
200+
"es2017.intl.d.ts",
201+
"es2017.typedarrays.d.ts",
200202
];
201203

202204
var es2017LibrarySourceMap = es2017LibrarySource.map(function (source) {
@@ -843,8 +845,9 @@ function cleanTestDirs() {
843845
}
844846

845847
// used to pass data from jake command line directly to run.js
846-
function writeTestConfigFile(tests, light, taskConfigsFolder, workerCount, stackTraceLimit, colors) {
848+
function writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, colors) {
847849
var testConfigContents = JSON.stringify({
850+
runners: runners ? runners.split(",") : undefined,
848851
test: tests ? [tests] : undefined,
849852
light: light,
850853
workerCount: workerCount,
@@ -870,6 +873,7 @@ function runConsoleTests(defaultReporter, runInParallel) {
870873
var debug = process.env.debug || process.env["debug-brk"] || process.env.d;
871874
var inspect = process.env.inspect || process.env["inspect-brk"] || process.env.i;
872875
var testTimeout = process.env.timeout || defaultTestTimeout;
876+
var runners = process.env.runners || process.env.runner || process.env.ru;
873877
var tests = process.env.test || process.env.tests || process.env.t;
874878
var light = process.env.light === undefined || process.env.light !== "false";
875879
var stackTraceLimit = process.env.stackTraceLimit;
@@ -891,8 +895,8 @@ function runConsoleTests(defaultReporter, runInParallel) {
891895
workerCount = process.env.workerCount || process.env.p || os.cpus().length;
892896
}
893897

894-
if (tests || light || taskConfigsFolder) {
895-
writeTestConfigFile(tests, light, taskConfigsFolder, workerCount, stackTraceLimit, colors);
898+
if (tests || runners || light || taskConfigsFolder) {
899+
writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, colors);
896900
}
897901

898902
if (tests && tests.toLocaleLowerCase() === "rwc") {
@@ -1027,14 +1031,15 @@ task("runtests-browser", ["browserify", nodeServerOutFile], function () {
10271031
cleanTestDirs();
10281032
host = "node";
10291033
var browser = process.env.browser || process.env.b || (os.platform() === "linux" ? "chrome" : "IE");
1034+
var runners = process.env.runners || process.env.runner || process.env.ru;
10301035
var tests = process.env.test || process.env.tests || process.env.t;
10311036
var light = process.env.light || false;
10321037
var testConfigFile = 'test.config';
10331038
if (fs.existsSync(testConfigFile)) {
10341039
fs.unlinkSync(testConfigFile);
10351040
}
1036-
if (tests || light) {
1037-
writeTestConfigFile(tests, light);
1041+
if (tests || runners || light) {
1042+
writeTestConfigFile(tests, runners, light);
10381043
}
10391044

10401045
tests = tests ? tests : '';
@@ -1282,7 +1287,7 @@ task("lint", ["build-rules"], () => {
12821287
const fileMatcher = process.env.f || process.env.file || process.env.files;
12831288
const files = fileMatcher
12841289
? `src/**/${fileMatcher}`
1285-
: "Gulpfile.ts 'scripts/generateLocalizedDiagnosticMessages.ts' 'scripts/tslint/**/*.ts' 'src/**/*.ts' --exclude src/lib/es5.d.ts --exclude 'src/lib/*.generated.d.ts'";
1290+
: "Gulpfile.ts 'scripts/generateLocalizedDiagnosticMessages.ts' 'scripts/tslint/**/*.ts' 'src/**/*.ts' --exclude 'src/lib/*.d.ts'";
12861291
const cmd = `node node_modules/tslint/bin/tslint ${files} --formatters-dir ./built/local/tslint/formatters --format autolinkableStylish`;
12871292
console.log("Linting: " + cmd);
12881293
jake.exec([cmd], { interactive: true }, () => {

netci.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import jobs.generation.Utilities;
55
def project = GithubProject
66
def branch = GithubBranchName
77

8-
def nodeVersions = ['stable', '6', '4']
8+
def nodeVersions = ['stable', '8', '6']
99

1010
nodeVersions.each { nodeVer ->
1111

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@
7474
"q": "latest",
7575
"run-sequence": "latest",
7676
"sorcery": "latest",
77+
"source-map-support": "latest",
7778
"through2": "latest",
7879
"travis-fold": "latest",
7980
"ts-node": "latest",
8081
"tslint": "latest",
82+
"vinyl": "latest",
8183
"colors": "latest",
8284
"typescript": "next"
8385
},

0 commit comments

Comments
 (0)