Skip to content

Commit 576f09f

Browse files
committed
Merge
2 parents 9827b63 + ccd4552 commit 576f09f

File tree

331 files changed

+281810
-272363
lines changed

Some content is hidden

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

331 files changed

+281810
-272363
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ tests/webhost/*.d.ts
3434
tests/webhost/webtsc.js
3535
tests/cases/**/*.js
3636
tests/cases/**/*.js.map
37-
tests/cases/**/*.d.ts
3837
*.config
3938
scripts/debug.bat
4039
scripts/run.bat
@@ -49,3 +48,4 @@ internal/
4948
**/.vs
5049
**/.vscode
5150
!**/.vscode/tasks.json
51+
!tests/cases/projects/projectOption/**/node_modules

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: 29 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ var os = require("os");
55
var path = require("path");
66
var child_process = require("child_process");
77
var Linter = require("tslint");
8+
var runTestsInParallel = require("./scripts/mocha-parallel").runTestsInParallel;
89

910
// Variables
1011
var compilerDirectory = "src/compiler/";
@@ -188,7 +189,10 @@ var es2016LibrarySourceMap = es2016LibrarySource.map(function (source) {
188189
return { target: "lib." + source, sources: ["header.d.ts", source] };
189190
});
190191

191-
var es2017LibrarySource = ["es2017.object.d.ts"];
192+
var es2017LibrarySource = [
193+
"es2017.object.d.ts",
194+
"es2017.sharedmemory.d.ts"
195+
];
192196

193197
var es2017LibrarySourceMap = es2017LibrarySource.map(function (source) {
194198
return { target: "lib." + source, sources: ["header.d.ts", source] };
@@ -309,10 +313,9 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
309313
}
310314

311315
if (useDebugMode) {
312-
options += " -sourcemap";
313-
if (!opts.noMapRoot) {
314-
options += " -mapRoot file:///" + path.resolve(path.dirname(outFile));
315-
}
316+
options += " --inlineSourceMap --inlineSources";
317+
} else {
318+
options += " --newLine LF";
316319
}
317320

318321
if (opts.stripInternal) {
@@ -480,7 +483,6 @@ var tscFile = path.join(builtLocalDirectory, compilerFilename);
480483
compileFile(tscFile, compilerSources, [builtLocalDirectory, copyright].concat(compilerSources), [copyright], /*useBuiltCompiler:*/ false);
481484

482485
var servicesFile = path.join(builtLocalDirectory, "typescriptServices.js");
483-
var servicesFileInBrowserTest = path.join(builtLocalDirectory, "typescriptServicesInBrowserTest.js");
484486
var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
485487
var nodePackageFile = path.join(builtLocalDirectory, "typescript.js");
486488
var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
@@ -512,16 +514,6 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
512514
fs.writeFileSync(nodeStandaloneDefinitionsFile, nodeStandaloneDefinitionsFileContents);
513515
});
514516

515-
compileFile(servicesFileInBrowserTest, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources),
516-
/*prefixes*/ [copyright],
517-
/*useBuiltCompiler*/ true,
518-
{ noOutFile: false, generateDeclarations: true, preserveConstEnums: true, keepComments: true, noResolve: false, stripInternal: true, noMapRoot: true },
519-
/*callback*/ function () {
520-
var content = fs.readFileSync(servicesFileInBrowserTest).toString();
521-
var i = content.lastIndexOf("\n");
522-
fs.writeFileSync(servicesFileInBrowserTest, content.substring(0, i) + "\r\n//# sourceURL=../built/local/typeScriptServices.js" + content.substring(i));
523-
});
524-
525517

526518
var serverFile = path.join(builtLocalDirectory, "tsserver.js");
527519
compileFile(serverFile, serverSources,[builtLocalDirectory, copyright].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true);
@@ -683,7 +675,6 @@ function cleanTestDirs() {
683675
// used to pass data from jake command line directly to run.js
684676
function writeTestConfigFile(tests, light, taskConfigsFolder, workerCount) {
685677
var testConfigContents = JSON.stringify({ test: tests ? [tests] : undefined, light: light, workerCount: workerCount, taskConfigsFolder: taskConfigsFolder });
686-
console.log('Running tests with config: ' + testConfigContents);
687678
fs.writeFileSync('test.config', testConfigContents);
688679
}
689680

@@ -735,51 +726,34 @@ function runConsoleTests(defaultReporter, runInParallel) {
735726
tests = tests ? ' -g "' + tests + '"' : '';
736727
var cmd = "mocha" + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run;
737728
console.log(cmd);
729+
730+
var savedNodeEnv = process.env.NODE_ENV;
731+
process.env.NODE_ENV = "development";
738732
exec(cmd, function () {
733+
process.env.NODE_ENV = savedNodeEnv;
739734
runLinter();
740735
finish();
741736
}, function(e, status) {
737+
process.env.NODE_ENV = savedNodeEnv;
742738
finish(status);
743739
});
744740

745741
}
746742
else {
747-
// run task to load all tests and partition them between workers
748-
var cmd = "mocha " + " -R min " + colors + run;
749-
console.log(cmd);
750-
exec(cmd, function() {
751-
// read all configuration files and spawn a worker for every config
752-
var configFiles = fs.readdirSync(taskConfigsFolder);
753-
var counter = configFiles.length;
754-
var firstErrorStatus;
755-
// schedule work for chunks
756-
configFiles.forEach(function (f) {
757-
var configPath = path.join(taskConfigsFolder, f);
758-
var workerCmd = "mocha" + " -t " + testTimeout + " -R " + reporter + " " + colors + " " + run + " --config='" + configPath + "'";
759-
console.log(workerCmd);
760-
exec(workerCmd, finishWorker, finishWorker)
761-
});
762-
763-
function finishWorker(e, errorStatus) {
764-
counter--;
765-
if (firstErrorStatus === undefined && errorStatus !== undefined) {
766-
firstErrorStatus = errorStatus;
767-
}
768-
if (counter !== 0) {
769-
complete();
770-
}
771-
else {
772-
// last worker clean everything and runs linter in case if there were no errors
773-
deleteTemporaryProjectOutput();
774-
jake.rmRf(taskConfigsFolder);
775-
if (firstErrorStatus === undefined) {
776-
runLinter();
777-
complete();
778-
}
779-
else {
780-
failWithStatus(firstErrorStatus);
781-
}
782-
}
743+
var savedNodeEnv = process.env.NODE_ENV;
744+
process.env.NODE_ENV = "development";
745+
runTestsInParallel(taskConfigsFolder, run, { testTimeout: testTimeout, noColors: colors === " --no-colors " }, function (err) {
746+
process.env.NODE_ENV = savedNodeEnv;
747+
748+
// last worker clean everything and runs linter in case if there were no errors
749+
deleteTemporaryProjectOutput();
750+
jake.rmRf(taskConfigsFolder);
751+
if (err) {
752+
fail(err);
753+
}
754+
else {
755+
runLinter();
756+
complete();
783757
}
784758
});
785759
}
@@ -834,12 +808,12 @@ compileFile(nodeServerOutFile, [nodeServerInFile], [builtLocalDirectory, tscFile
834808

835809
desc("Runs browserify on run.js to produce a file suitable for running tests in the browser");
836810
task("browserify", ["tests", builtLocalDirectory, nodeServerOutFile], function() {
837-
var cmd = 'browserify built/local/run.js -o built/local/bundle.js';
811+
var cmd = 'browserify built/local/run.js -d -o built/local/bundle.js';
838812
exec(cmd);
839813
}, {async: true});
840814

841815
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]");
842-
task("runtests-browser", ["tests", "browserify", builtLocalDirectory, servicesFileInBrowserTest], function() {
816+
task("runtests-browser", ["tests", "browserify", builtLocalDirectory, servicesFile], function() {
843817
cleanTestDirs();
844818
host = "node";
845819
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)