Skip to content

Commit 3354436

Browse files
committed
Merge branch 'master' of https://github.com/Microsoft/TypeScript into fixLargeProjectTry2
# Conflicts: # src/compiler/program.ts # tests/cases/unittests/tsserverProjectSystem.ts
2 parents e41b10b + 7bb739f commit 3354436

File tree

377 files changed

+279030
-272817
lines changed

Some content is hidden

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

377 files changed

+279030
-272817
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ These two files represent the DOM typings and are auto-generated. To make any mo
9191

9292
## Running the Tests
9393

94-
To run all tests, invoke the `runtests` target using jake:
94+
To run all tests, invoke the `runtests-parallel` target using jake:
9595

9696
```Shell
97-
jake runtests
97+
jake runtests-parallel
9898
```
9999

100100
This run will all tests; to run only a specific subset of tests, use:

Jakefile.js

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename);
276276
* @param {boolean} opts.noResolve: true if compiler should not include non-rooted files in compilation
277277
* @param {boolean} opts.stripInternal: true if compiler should remove declarations marked as @internal
278278
* @param {boolean} opts.noMapRoot: true if compiler omit mapRoot option
279+
* @param {boolean} opts.inlineSourceMap: true if compiler should inline sourceMap
279280
* @param callback: a function to execute after the compilation process ends
280281
*/
281282
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts, callback) {
@@ -313,7 +314,14 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
313314
}
314315

315316
if (useDebugMode) {
316-
options += " --inlineSourceMap --inlineSources";
317+
if (opts.inlineSourceMap) {
318+
options += " --inlineSourceMap --inlineSources";
319+
} else {
320+
options += " -sourcemap";
321+
if (!opts.noMapRoot) {
322+
options += " -mapRoot file:///" + path.resolve(path.dirname(outFile));
323+
}
324+
}
317325
} else {
318326
options += " --newLine LF";
319327
}
@@ -483,6 +491,7 @@ var tscFile = path.join(builtLocalDirectory, compilerFilename);
483491
compileFile(tscFile, compilerSources, [builtLocalDirectory, copyright].concat(compilerSources), [copyright], /*useBuiltCompiler:*/ false);
484492

485493
var servicesFile = path.join(builtLocalDirectory, "typescriptServices.js");
494+
var servicesFileInBrowserTest = path.join(builtLocalDirectory, "typescriptServicesInBrowserTest.js");
486495
var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
487496
var nodePackageFile = path.join(builtLocalDirectory, "typescript.js");
488497
var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
@@ -491,7 +500,13 @@ var nodeStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescript_s
491500
compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources),
492501
/*prefixes*/ [copyright],
493502
/*useBuiltCompiler*/ true,
494-
{ noOutFile: false, generateDeclarations: true, preserveConstEnums: true, keepComments: true, noResolve: false, stripInternal: true },
503+
/*opts*/ { noOutFile: false,
504+
generateDeclarations: true,
505+
preserveConstEnums: true,
506+
keepComments: true,
507+
noResolve: false,
508+
stripInternal: true
509+
},
495510
/*callback*/ function () {
496511
jake.cpR(servicesFile, nodePackageFile, {silent: true});
497512

@@ -514,6 +529,21 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
514529
fs.writeFileSync(nodeStandaloneDefinitionsFile, nodeStandaloneDefinitionsFileContents);
515530
});
516531

532+
compileFile(
533+
servicesFileInBrowserTest,
534+
servicesSources,
535+
[builtLocalDirectory, copyright].concat(servicesSources),
536+
/*prefixes*/ [copyright],
537+
/*useBuiltCompiler*/ true,
538+
{ noOutFile: false,
539+
generateDeclarations: true,
540+
preserveConstEnums: true,
541+
keepComments: true,
542+
noResolve: false,
543+
stripInternal: true,
544+
noMapRoot: true,
545+
inlineSourceMap: true
546+
});
517547

518548
var serverFile = path.join(builtLocalDirectory, "tsserver.js");
519549
compileFile(serverFile, serverSources,[builtLocalDirectory, copyright].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true);
@@ -614,7 +644,13 @@ directory(builtLocalDirectory);
614644

615645
// Task to build the tests infrastructure using the built compiler
616646
var run = path.join(builtLocalDirectory, "run.js");
617-
compileFile(run, harnessSources, [builtLocalDirectory, tscFile].concat(libraryTargets).concat(harnessSources), [], /*useBuiltCompiler:*/ true);
647+
compileFile(
648+
/*outFile*/ run,
649+
/*source*/ harnessSources,
650+
/*prereqs*/ [builtLocalDirectory, tscFile].concat(libraryTargets).concat(harnessSources),
651+
/*prefixes*/ [],
652+
/*useBuiltCompiler:*/ true,
653+
/*opts*/ { inlineSourceMap: true });
618654

619655
var internalTests = "internal/";
620656

@@ -718,24 +754,34 @@ function runConsoleTests(defaultReporter, runInParallel) {
718754
colors = process.env.colors || process.env.color;
719755
colors = colors ? ' --no-colors ' : ' --colors ';
720756
reporter = process.env.reporter || process.env.r || defaultReporter;
757+
var bail = (process.env.bail || process.env.b) ? "--bail" : "";
721758
var lintFlag = process.env.lint !== 'false';
722759

723760
// timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally
724761
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
725762
if(!runInParallel) {
726763
tests = tests ? ' -g "' + tests + '"' : '';
727-
var cmd = "mocha" + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run;
764+
var cmd = "mocha" + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + bail + ' -t ' + testTimeout + ' ' + run;
728765
console.log(cmd);
766+
767+
var savedNodeEnv = process.env.NODE_ENV;
768+
process.env.NODE_ENV = "development";
729769
exec(cmd, function () {
770+
process.env.NODE_ENV = savedNodeEnv;
730771
runLinter();
731772
finish();
732773
}, function(e, status) {
774+
process.env.NODE_ENV = savedNodeEnv;
733775
finish(status);
734776
});
735777

736778
}
737779
else {
780+
var savedNodeEnv = process.env.NODE_ENV;
781+
process.env.NODE_ENV = "development";
738782
runTestsInParallel(taskConfigsFolder, run, { testTimeout: testTimeout, noColors: colors === " --no-colors " }, function (err) {
783+
process.env.NODE_ENV = savedNodeEnv;
784+
739785
// last worker clean everything and runs linter in case if there were no errors
740786
deleteTemporaryProjectOutput();
741787
jake.rmRf(taskConfigsFolder);
@@ -780,7 +826,7 @@ task("runtests-parallel", ["build-rules", "tests", builtLocalDirectory], functio
780826
runConsoleTests('min', /*runInParallel*/ true);
781827
}, {async: true});
782828

783-
desc("Runs the tests using the built run.js file. Optional arguments are: t[ests]=regex r[eporter]=[list|spec|json|<more>] d[ebug]=true color[s]=false lint=true.");
829+
desc("Runs the tests using the built run.js file. Optional arguments are: t[ests]=regex r[eporter]=[list|spec|json|<more>] d[ebug]=true color[s]=false lint=true bail=false.");
784830
task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
785831
runConsoleTests('mocha-fivemat-progress-reporter', /*runInParallel*/ false);
786832
}, {async: true});
@@ -804,7 +850,7 @@ task("browserify", ["tests", builtLocalDirectory, nodeServerOutFile], function()
804850
}, {async: true});
805851

806852
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]");
807-
task("runtests-browser", ["tests", "browserify", builtLocalDirectory, servicesFile], function() {
853+
task("runtests-browser", ["tests", "browserify", builtLocalDirectory, servicesFileInBrowserTest], function() {
808854
cleanTestDirs();
809855
host = "node";
810856
port = process.env.port || process.env.p || '8888';

lib/lib.d.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,24 @@ interface ObjectConstructor {
152152
*/
153153
getOwnPropertyNames(o: any): string[];
154154

155+
/**
156+
* Creates an object that has null prototype.
157+
* @param o Object to use as a prototype. May be null
158+
*/
159+
create(o: null): any;
160+
161+
/**
162+
* Creates an object that has the specified prototype, and that optionally contains specified properties.
163+
* @param o Object to use as a prototype. May be null
164+
*/
165+
create<T>(o: T): T;
166+
155167
/**
156168
* Creates an object that has the specified prototype, and that optionally contains specified properties.
157169
* @param o Object to use as a prototype. May be null
158170
* @param properties JavaScript object that contains one or more property descriptors.
159171
*/
160-
create(o: any, properties?: PropertyDescriptorMap): any;
172+
create(o: any, properties: PropertyDescriptorMap): any;
161173

162174
/**
163175
* Adds a property to an object, or modifies attributes of an existing property.

lib/lib.es2017.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ and limitations under the License.
1515

1616
/// <reference no-default-lib="true"/>
1717
/// <reference path="lib.es2016.d.ts" />
18-
/// <reference path="lib.es2017.object.d.ts" />
18+
/// <reference path="lib.es2017.object.d.ts" />
19+
/// <reference path="lib.es2017.sharedmemory.d.ts" />

lib/lib.es2017.sharedmemory.d.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*! *****************************************************************************
2+
Copyright (c) Microsoft Corporation. All rights reserved.
3+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4+
this file except in compliance with the License. You may obtain a copy of the
5+
License at http://www.apache.org/licenses/LICENSE-2.0
6+
7+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10+
MERCHANTABLITY OR NON-INFRINGEMENT.
11+
12+
See the Apache Version 2.0 License for specific language governing permissions
13+
and limitations under the License.
14+
***************************************************************************** */
15+
16+
/// <reference no-default-lib="true"/>
17+
/// <reference path="lib.es2015.symbol.d.ts" />
18+
/// <reference path="lib.es2015.symbol.wellknown.d.ts" />
19+
20+
interface SharedArrayBuffer {
21+
/**
22+
* Read-only. The length of the ArrayBuffer (in bytes).
23+
*/
24+
readonly byteLength: number;
25+
26+
/*
27+
* The SharedArrayBuffer constructor's length property whose value is 1.
28+
*/
29+
length: number;
30+
/**
31+
* Returns a section of an SharedArrayBuffer.
32+
*/
33+
slice(begin:number, end?:number): SharedArrayBuffer;
34+
readonly [Symbol.species]: SharedArrayBuffer;
35+
readonly [Symbol.toStringTag]: "SharedArrayBuffer";
36+
}
37+
38+
interface SharedArrayBufferConstructor {
39+
readonly prototype: SharedArrayBuffer;
40+
new (byteLength: number): SharedArrayBuffer;
41+
}
42+
43+
declare var SharedArrayBuffer: SharedArrayBufferConstructor;

lib/lib.es5.d.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,24 @@ interface ObjectConstructor {
152152
*/
153153
getOwnPropertyNames(o: any): string[];
154154

155+
/**
156+
* Creates an object that has null prototype.
157+
* @param o Object to use as a prototype. May be null
158+
*/
159+
create(o: null): any;
160+
161+
/**
162+
* Creates an object that has the specified prototype, and that optionally contains specified properties.
163+
* @param o Object to use as a prototype. May be null
164+
*/
165+
create<T>(o: T): T;
166+
155167
/**
156168
* Creates an object that has the specified prototype, and that optionally contains specified properties.
157169
* @param o Object to use as a prototype. May be null
158170
* @param properties JavaScript object that contains one or more property descriptors.
159171
*/
160-
create(o: any, properties?: PropertyDescriptorMap): any;
172+
create(o: any, properties: PropertyDescriptorMap): any;
161173

162174
/**
163175
* Adds a property to an object, or modifies attributes of an existing property.

lib/lib.es6.d.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,24 @@ interface ObjectConstructor {
152152
*/
153153
getOwnPropertyNames(o: any): string[];
154154

155+
/**
156+
* Creates an object that has null prototype.
157+
* @param o Object to use as a prototype. May be null
158+
*/
159+
create(o: null): any;
160+
161+
/**
162+
* Creates an object that has the specified prototype, and that optionally contains specified properties.
163+
* @param o Object to use as a prototype. May be null
164+
*/
165+
create<T>(o: T): T;
166+
155167
/**
156168
* Creates an object that has the specified prototype, and that optionally contains specified properties.
157169
* @param o Object to use as a prototype. May be null
158170
* @param properties JavaScript object that contains one or more property descriptors.
159171
*/
160-
create(o: any, properties?: PropertyDescriptorMap): any;
172+
create(o: any, properties: PropertyDescriptorMap): any;
161173

162174
/**
163175
* Adds a property to an object, or modifies attributes of an existing property.

0 commit comments

Comments
 (0)