Skip to content

Commit 2dec11c

Browse files
author
Andy Hanson
committed
Merge branch 'master' into completionsCombineOverloads
2 parents 96c2085 + 06aeab8 commit 2dec11c

File tree

1,539 files changed

+207534
-90022
lines changed

Some content is hidden

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

1,539 files changed

+207534
-90022
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,12 @@ 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/
70+
tests/baselines/reference/dt

.gitmodules

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[submodule "tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter"]
2+
path = tests/cases/user/TypeScript-React-Starter/TypeScript-React-Starter
3+
url = https://github.com/Microsoft/TypeScript-React-Starter
4+
ignore = all
5+
shallow = true
6+
[submodule "tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter"]
7+
path = tests/cases/user/TypeScript-Node-Starter/TypeScript-Node-Starter
8+
url = https://github.com/Microsoft/TypeScript-Node-Starter.git
9+
ignore = all
10+
shallow = true
11+
[submodule "tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter"]
12+
path = tests/cases/user/TypeScript-React-Native-Starter/TypeScript-React-Native-Starter
13+
url = https://github.com/Microsoft/TypeScript-React-Native-Starter.git
14+
ignore = all
15+
shallow = true
16+
[submodule "tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter"]
17+
path = tests/cases/user/TypeScript-Vue-Starter/TypeScript-Vue-Starter
18+
url = https://github.com/Microsoft/TypeScript-Vue-Starter.git
19+
ignore = all
20+
shallow = true
21+
[submodule "tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter"]
22+
path = tests/cases/user/TypeScript-WeChat-Starter/TypeScript-WeChat-Starter
23+
url = https://github.com/Microsoft/TypeScript-WeChat-Starter.git
24+
ignore = all
25+
shallow = true

.travis.yml

Lines changed: 1 addition & 1 deletion
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

Lines changed: 55 additions & 57 deletions
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,35 @@ 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] }));
147+
148+
const es2018LibrarySource = [];
149+
const es2018LibrarySourceMap = es2018LibrarySource.map(source =>
150+
({ target: "lib." + source, sources: ["header.d.ts", source] }));
146151

147152
const esnextLibrarySource = [
148153
"esnext.asynciterable.d.ts"
149154
];
150155

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

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

@@ -166,19 +170,20 @@ const librarySourceMap = [
166170
{ target: "lib.es2015.d.ts", sources: ["header.d.ts", "es2015.d.ts"] },
167171
{ target: "lib.es2016.d.ts", sources: ["header.d.ts", "es2016.d.ts"] },
168172
{ target: "lib.es2017.d.ts", sources: ["header.d.ts", "es2017.d.ts"] },
173+
{ target: "lib.es2018.d.ts", sources: ["header.d.ts", "es2018.d.ts"] },
169174
{ target: "lib.esnext.d.ts", sources: ["header.d.ts", "esnext.d.ts"] },
170175

171176
// JavaScript + all host library
172177
{ target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources) },
173178
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") },
174179
{ target: "lib.es2016.full.d.ts", sources: ["header.d.ts", "es2016.d.ts"].concat(hostsLibrarySources, "dom.iterable.d.ts") },
175180
{ target: "lib.es2017.full.d.ts", sources: ["header.d.ts", "es2017.d.ts"].concat(hostsLibrarySources, "dom.iterable.d.ts") },
181+
{ target: "lib.es2018.full.d.ts", sources: ["header.d.ts", "es2018.d.ts"].concat(hostsLibrarySources, "dom.iterable.d.ts") },
176182
{ target: "lib.esnext.full.d.ts", sources: ["header.d.ts", "esnext.d.ts"].concat(hostsLibrarySources, "dom.iterable.d.ts") },
177-
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap, esnextLibrarySourceMap);
183+
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap, es2018LibrarySourceMap, esnextLibrarySourceMap);
178184

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

183188
/**
184189
* .lcg file is what localization team uses to know what messages to localize.
@@ -193,22 +198,19 @@ const generatedLCGFile = path.join(builtLocalDirectory, "enu", "diagnosticMessag
193198
* 2. 'src\compiler\diagnosticMessages.generated.json' => 'built\local\ENU\diagnosticMessages.generated.json.lcg'
194199
* generate the lcg file (source of messages to localize) from the diagnosticMessages.generated.json
195200
*/
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);
201+
const localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-CN", "zh-TW"]
202+
.map(f => path.join(builtLocalDirectory, f, "diagnosticMessages.generated.json"))
203+
.concat(generatedLCGFile);
199204

200205
for (const i in libraryTargets) {
201206
const entry = librarySourceMap[i];
202207
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)
208+
const sources = [copyright].concat(entry.sources.map(s => path.join(libraryDirectory, s)));
209+
gulp.task(target, /*help*/ false, [], () =>
210+
gulp.src(sources)
208211
.pipe(newer(target))
209212
.pipe(concat(target, { newLine: "\n\n" }))
210-
.pipe(gulp.dest("."));
211-
});
213+
.pipe(gulp.dest(".")));
212214
}
213215

214216
const configureNightlyJs = path.join(scriptsDirectory, "configureNightly.js");
@@ -575,9 +577,7 @@ gulp.task(specMd, /*help*/ false, [word2mdJs], (done) => {
575577
const specMDFullPath = path.resolve(specMd);
576578
const cmd = "cscript //nologo " + word2mdJs + " \"" + specWordFullPath + "\" " + "\"" + specMDFullPath + "\"";
577579
console.log(cmd);
578-
cp.exec(cmd, function() {
579-
done();
580-
});
580+
cp.exec(cmd, done);
581581
});
582582

583583
gulp.task("generate-spec", "Generates a Markdown version of the Language Specification", [specMd]);
@@ -599,7 +599,7 @@ gulp.task("VerifyLKG", /*help*/ false, [], () => {
599599
". The following files are missing:\n" + missingFiles.join("\n"));
600600
}
601601
// 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));
602+
return gulp.src([...expectedFiles, path.join(builtLocalDirectory, "**"), `!${path.join(builtLocalDirectory, "tslint")}`, `!${path.join(builtLocalDirectory, "*.*")}`]).pipe(gulp.dest(lkgDirectory));
603603
});
604604

605605
gulp.task("LKGInternal", /*help*/ false, ["lib", "local"]);
@@ -658,6 +658,7 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
658658
const debug = cmdLineOptions.debug;
659659
const inspect = cmdLineOptions.inspect;
660660
const tests = cmdLineOptions.tests;
661+
const runners = cmdLineOptions.runners;
661662
const light = cmdLineOptions.light;
662663
const stackTraceLimit = cmdLineOptions.stackTraceLimit;
663664
const testConfigFile = "test.config";
@@ -678,8 +679,8 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
678679
workerCount = cmdLineOptions.workers;
679680
}
680681

681-
if (tests || light || taskConfigsFolder) {
682-
writeTestConfigFile(tests, light, taskConfigsFolder, workerCount, stackTraceLimit);
682+
if (tests || runners || light || taskConfigsFolder) {
683+
writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit);
683684
}
684685

685686
if (tests && tests.toLocaleLowerCase() === "rwc") {
@@ -714,17 +715,13 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
714715
}
715716
args.push(run);
716717
setNodeEnvToDevelopment();
717-
exec(mocha, args, lintThenFinish, function(e, status) {
718-
finish(e, status);
719-
});
718+
exec(mocha, args, lintThenFinish, finish);
720719

721720
}
722721
else {
723722
// run task to load all tests and partition them between workers
724723
setNodeEnvToDevelopment();
725-
exec(host, [run], lintThenFinish, function(e, status) {
726-
finish(e, status);
727-
});
724+
exec(host, [run], lintThenFinish, finish);
728725
}
729726
});
730727

@@ -874,8 +871,8 @@ function cleanTestDirs(done: (e?: any) => void) {
874871
}
875872

876873
// 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 });
874+
function writeTestConfigFile(tests: string, runners: string, light: boolean, taskConfigsFolder?: string, workerCount?: number, stackTraceLimit?: string) {
875+
const testConfigContents = JSON.stringify({ test: tests ? [tests] : undefined, runner: runners ? runners.split(",") : undefined, light, workerCount, stackTraceLimit, taskConfigsFolder, noColor: !cmdLineOptions.colors });
879876
console.log("Running tests with config: " + testConfigContents);
880877
fs.writeFileSync("test.config", testConfigContents);
881878
}
@@ -886,13 +883,14 @@ gulp.task("runtests-browser", "Runs the tests using the built run.js file like '
886883
if (err) { console.error(err); done(err); process.exit(1); }
887884
host = "node";
888885
const tests = cmdLineOptions.tests;
886+
const runners = cmdLineOptions.runners;
889887
const light = cmdLineOptions.light;
890888
const testConfigFile = "test.config";
891889
if (fs.existsSync(testConfigFile)) {
892890
fs.unlinkSync(testConfigFile);
893891
}
894-
if (tests || light) {
895-
writeTestConfigFile(tests, light);
892+
if (tests || runners || light) {
893+
writeTestConfigFile(tests, runners, light);
896894
}
897895

898896
const args = [nodeServerOutFile];
@@ -1006,7 +1004,7 @@ gulp.task(loggedIOJsPath, /*help*/ false, [], (done) => {
10061004
const temp = path.join(builtLocalDirectory, "temp");
10071005
mkdirP(temp, (err) => {
10081006
if (err) { console.error(err); done(err); process.exit(1); }
1009-
exec(host, [LKGCompiler, "--types", "--target es5", "--lib es5", "--outdir", temp, loggedIOpath], () => {
1007+
exec(host, [lkgCompiler, "--types", "--target es5", "--lib es5", "--outdir", temp, loggedIOpath], () => {
10101008
fs.renameSync(path.join(temp, "/harness/loggedIO.js"), loggedIOJsPath);
10111009
del(temp).then(() => done(), done);
10121010
}, done);
@@ -1043,7 +1041,7 @@ gulp.task("update-sublime", "Updates the sublime plugin's tsserver", ["local", s
10431041
});
10441042

10451043
gulp.task("build-rules", "Compiles tslint rules to js", () => {
1046-
const settings: tsc.Settings = getCompilerSettings({ module: "commonjs", "lib": ["es6"] }, /*useBuiltCompiler*/ false);
1044+
const settings: tsc.Settings = getCompilerSettings({ module: "commonjs", lib: ["es6"] }, /*useBuiltCompiler*/ false);
10471045
const dest = path.join(builtLocalDirectory, "tslint");
10481046
return gulp.src("scripts/tslint/**/*.ts")
10491047
.pipe(newer({
@@ -1082,7 +1080,7 @@ function sendNextFile(files: {path: string}[], child: cp.ChildProcess, callback:
10821080
function spawnLintWorker(files: {path: string}[], callback: (failures: number) => void) {
10831081
const child = cp.fork("./scripts/parallel-lint");
10841082
let failures = 0;
1085-
child.on("message", function(data) {
1083+
child.on("message", data => {
10861084
switch (data.kind) {
10871085
case "result":
10881086
if (data.failures > 0) {
@@ -1106,7 +1104,7 @@ gulp.task("lint", "Runs tslint on the compiler sources. Optional arguments are:
11061104
const fileMatcher = cmdLineOptions.files;
11071105
const files = fileMatcher
11081106
? `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'";
1107+
: "Gulpfile.ts 'scripts/generateLocalizedDiagnosticMessages.ts' 'scripts/tslint/**/*.ts' 'src/**/*.ts' --exclude 'src/lib/*.d.ts'";
11101108
const cmd = `node node_modules/tslint/bin/tslint ${files} --formatters-dir ./built/local/tslint/formatters --format autolinkableStylish`;
11111109
console.log("Linting: " + cmd);
11121110
child_process.execSync(cmd, { stdio: [0, 1, 2] });

0 commit comments

Comments
 (0)