Merge branch 'master' into incrementalBuildInfo

This commit is contained in:
Sheetal Nandi
2019-02-14 12:19:10 -08:00
99 changed files with 1913 additions and 1068 deletions
+1 -1
View File
@@ -3296,7 +3296,7 @@ namespace ts {
let transformFlags = subtreeFlags;
if (!node.variableDeclaration) {
transformFlags |= TransformFlags.AssertESNext;
transformFlags |= TransformFlags.AssertES2019;
}
else if (isBindingPattern(node.variableDeclaration.name)) {
transformFlags |= TransformFlags.AssertES2015;
+40 -41
View File
@@ -12693,10 +12693,11 @@ namespace ts {
else if (source.flags & TypeFlags.Conditional) {
if (target.flags & TypeFlags.Conditional) {
// Two conditional types 'T1 extends U1 ? X1 : Y1' and 'T2 extends U2 ? X2 : Y2' are related if
// one of T1 and T2 is related to the other, U1 and U2 are identical types, X1 is related to X2,
// and Y1 is related to Y2.
if (isTypeIdenticalTo((<ConditionalType>source).extendsType, (<ConditionalType>target).extendsType) &&
(isRelatedTo((<ConditionalType>source).checkType, (<ConditionalType>target).checkType) || isRelatedTo((<ConditionalType>target).checkType, (<ConditionalType>source).checkType))) {
// they have the same distributivity, T1 and T2 are identical types, U1 and U2 are identical
// types, X1 is related to X2, and Y1 is related to Y2.
if ((<ConditionalType>source).root.isDistributive === (<ConditionalType>target).root.isDistributive &&
isTypeIdenticalTo((<ConditionalType>source).extendsType, (<ConditionalType>target).extendsType) &&
isTypeIdenticalTo((<ConditionalType>source).checkType, (<ConditionalType>target).checkType)) {
if (result = isRelatedTo(getTrueTypeFromConditionalType(<ConditionalType>source), getTrueTypeFromConditionalType(<ConditionalType>target), reportErrors)) {
result &= isRelatedTo(getFalseTypeFromConditionalType(<ConditionalType>source), getFalseTypeFromConditionalType(<ConditionalType>target), reportErrors);
}
@@ -14472,26 +14473,15 @@ namespace ts {
inferFromTypes(source, getUnionType([getTrueTypeFromConditionalType(<ConditionalType>target), getFalseTypeFromConditionalType(<ConditionalType>target)]));
}
else if (target.flags & TypeFlags.UnionOrIntersection) {
const targetTypes = (<UnionOrIntersectionType>target).types;
let typeVariableCount = 0;
let typeVariable: TypeParameter | IndexedAccessType | undefined;
// First infer to each type in union or intersection that isn't a type variable
for (const t of targetTypes) {
if (getInferenceInfoForType(t)) {
typeVariable = <InstantiableType>t;
typeVariableCount++;
}
else {
inferFromTypes(source, t);
}
}
// Next, if target containings a single naked type variable, make a secondary inference to that type
// variable. This gives meaningful results for union types in co-variant positions and intersection
// types in contra-variant positions (such as callback parameters).
if (typeVariableCount === 1) {
for (const t of (<UnionOrIntersectionType>target).types) {
const savePriority = priority;
priority |= InferencePriority.NakedTypeVariable;
inferFromTypes(source, typeVariable!);
// Inferences directly to naked type variables are given lower priority as they are
// less specific. For example, when inferring from Promise<string> to T | Promise<T>,
// we want to infer string for T, not Promise<string> | string.
if (getInferenceInfoForType(t)) {
priority |= InferencePriority.NakedTypeVariable;
}
inferFromTypes(source, t);
priority = savePriority;
}
}
@@ -14579,11 +14569,11 @@ namespace ts {
return undefined;
}
function inferFromMappedTypeConstraint(source: Type, target: Type, constraintType: Type): boolean {
function inferToMappedType(source: Type, target: MappedType, constraintType: Type): boolean {
if (constraintType.flags & TypeFlags.Union) {
let result = false;
for (const type of (constraintType as UnionType).types) {
result = inferFromMappedTypeConstraint(source, target, type) || result;
result = inferToMappedType(source, target, type) || result;
}
return result;
}
@@ -14594,7 +14584,7 @@ namespace ts {
// such that direct inferences to T get priority over inferences to Partial<T>, for example.
const inference = getInferenceInfoForType((<IndexType>constraintType).type);
if (inference && !inference.isFixed) {
const inferredType = inferTypeForHomomorphicMappedType(source, <MappedType>target, constraintType as IndexType);
const inferredType = inferTypeForHomomorphicMappedType(source, target, <IndexType>constraintType);
if (inferredType) {
const savePriority = priority;
priority |= InferencePriority.HomomorphicMappedType;
@@ -14605,18 +14595,28 @@ namespace ts {
return true;
}
if (constraintType.flags & TypeFlags.TypeParameter) {
// We're inferring from some source type S to a mapped type { [P in T]: X }, where T is a type
// parameter. Infer from 'keyof S' to T and infer from a union of each property type in S to X.
// We're inferring from some source type S to a mapped type { [P in K]: X }, where K is a type
// parameter. First infer from 'keyof S' to K.
const savePriority = priority;
priority |= InferencePriority.MappedTypeConstraint;
inferFromTypes(getIndexType(source), constraintType);
priority = savePriority;
// If K is constrained to a type C, also infer to C. Thus, for a mapped type { [P in K]: X },
// where K extends keyof T, we make the same inferences as for a homomorphic mapped type
// { [P in keyof T]: X }. This enables us to make meaningful inferences when the target is a
// Pick<T, K>.
const extendedConstraint = getConstraintOfType(constraintType);
if (extendedConstraint && inferToMappedType(source, target, extendedConstraint)) {
return true;
}
// If no inferences can be made to K's constraint, infer from a union of the property types
// in the source to the template type X.
const valueTypes = compact([
getIndexTypeOfType(source, IndexKind.String),
getIndexTypeOfType(source, IndexKind.Number),
...map(getPropertiesOfType(source), getTypeOfSymbol)
]);
inferFromTypes(getUnionType(valueTypes), getTemplateTypeFromMappedType(<MappedType>target));
inferFromTypes(getUnionType(valueTypes), getTemplateTypeFromMappedType(target));
return true;
}
return false;
@@ -14631,7 +14631,7 @@ namespace ts {
}
if (getObjectFlags(target) & ObjectFlags.Mapped) {
const constraintType = getConstraintTypeFromMappedType(<MappedType>target);
if (inferFromMappedTypeConstraint(source, target, constraintType)) {
if (inferToMappedType(source, <MappedType>target, constraintType)) {
return;
}
}
@@ -21550,13 +21550,8 @@ namespace ts {
}
if (signature.hasRestParameter) {
const restType = getTypeOfSymbol(signature.parameters[paramCount]);
if (isTupleType(restType)) {
if (pos - paramCount < getLengthOfTupleType(restType)) {
return restType.typeArguments![pos - paramCount];
}
return getRestTypeOfTupleType(restType);
}
return getIndexTypeOfType(restType, IndexKind.Number);
const indexType = getLiteralType(pos - paramCount);
return getIndexedAccessType(restType, indexType);
}
return undefined;
}
@@ -21564,18 +21559,22 @@ namespace ts {
function getRestTypeAtPosition(source: Signature, pos: number): Type {
const paramCount = getParameterCount(source);
const restType = getEffectiveRestType(source);
if (restType && pos === paramCount - 1) {
const nonRestCount = paramCount - (restType ? 1 : 0);
if (restType && pos === nonRestCount) {
return restType;
}
const start = restType ? Math.min(pos, paramCount - 1) : pos;
const types = [];
const names = [];
for (let i = start; i < paramCount; i++) {
for (let i = pos; i < nonRestCount; i++) {
types.push(getTypeAtPosition(source, i));
names.push(getParameterNameAtPosition(source, i));
}
if (restType) {
types.push(getIndexedAccessType(restType, numberType));
names.push(getParameterNameAtPosition(source, nonRestCount));
}
const minArgumentCount = getMinArgumentCount(source);
const minLength = minArgumentCount < start ? 0 : minArgumentCount - start;
const minLength = minArgumentCount < pos ? 0 : minArgumentCount - pos;
return createTupleType(types, minLength, !!restType, /*readonly*/ false, names);
}
+8 -3
View File
@@ -15,6 +15,7 @@ namespace ts {
["es2016", "lib.es2016.d.ts"],
["es2017", "lib.es2017.d.ts"],
["es2018", "lib.es2018.d.ts"],
["es2019", "lib.es2019.d.ts"],
["esnext", "lib.esnext.d.ts"],
// Host only
["dom", "lib.dom.d.ts"],
@@ -42,8 +43,11 @@ namespace ts {
["es2018.intl", "lib.es2018.intl.d.ts"],
["es2018.promise", "lib.es2018.promise.d.ts"],
["es2018.regexp", "lib.es2018.regexp.d.ts"],
["esnext.array", "lib.esnext.array.d.ts"],
["esnext.symbol", "lib.esnext.symbol.d.ts"],
["es2019.array", "lib.es2019.array.d.ts"],
["es2019.string", "lib.es2019.string.d.ts"],
["es2019.symbol", "lib.es2019.symbol.d.ts"],
["esnext.array", "lib.es2019.array.d.ts"],
["esnext.symbol", "lib.es2019.symbol.d.ts"],
["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"],
["esnext.intl", "lib.esnext.intl.d.ts"],
["esnext.bigint", "lib.esnext.bigint.d.ts"]
@@ -198,6 +202,7 @@ namespace ts {
es2016: ScriptTarget.ES2016,
es2017: ScriptTarget.ES2017,
es2018: ScriptTarget.ES2018,
es2019: ScriptTarget.ES2019,
esnext: ScriptTarget.ESNext,
}),
affectsSourceFile: true,
@@ -205,7 +210,7 @@ namespace ts {
paramType: Diagnostics.VERSION,
showInSimplifiedHelpView: true,
category: Diagnostics.Basic_Options,
description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_ES2018_or_ESNEXT,
description: Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_ES2018_ES2019_or_ESNEXT,
},
{
name: "module",
+4 -3
View File
@@ -1396,9 +1396,10 @@ namespace ts {
export function assign<T extends object>(t: T, ...args: (T | undefined)[]) {
for (const arg of args) {
for (const p in arg!) {
if (hasProperty(arg!, p)) {
t![p] = arg![p]; // TODO: GH#23368
if (arg === undefined) continue;
for (const p in arg) {
if (hasProperty(arg, p)) {
t[p] = arg[p];
}
}
}
+1 -1
View File
@@ -3109,7 +3109,7 @@
"category": "Message",
"code": 6014
},
"Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'.": {
"Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'.": {
"category": "Message",
"code": 6015
},
+4
View File
@@ -42,6 +42,10 @@ namespace ts {
transformers.push(transformESNext);
}
if (languageVersion < ScriptTarget.ES2019) {
transformers.push(transformES2019);
}
if (languageVersion < ScriptTarget.ES2018) {
transformers.push(transformES2018);
}
@@ -1012,7 +1012,9 @@ namespace ts {
if (!isPropertyAccessExpression(p.valueDeclaration)) {
return undefined;
}
getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration);
const type = resolver.createTypeOfDeclaration(p.valueDeclaration, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker);
getSymbolAccessibilityDiagnostic = oldDiag;
const varDecl = createVariableDeclaration(unescapeLeadingUnderscores(p.escapedName), type, /*initializer*/ undefined);
return createVariableStatement(/*modifiers*/ undefined, createVariableDeclarationList([varDecl]));
});
@@ -26,7 +26,8 @@ namespace ts {
| ImportEqualsDeclaration
| TypeAliasDeclaration
| ConstructorDeclaration
| IndexSignatureDeclaration;
| IndexSignatureDeclaration
| PropertyAccessExpression;
export function canProduceDiagnostics(node: Node): node is DeclarationDiagnosticProducing {
return isVariableDeclaration(node) ||
@@ -46,7 +47,8 @@ namespace ts {
isImportEqualsDeclaration(node) ||
isTypeAliasDeclaration(node) ||
isConstructorDeclaration(node) ||
isIndexSignatureDeclaration(node);
isIndexSignatureDeclaration(node) ||
isPropertyAccessExpression(node);
}
export function createGetSymbolAccessibilityDiagnosticForNodeName(node: DeclarationDiagnosticProducing) {
@@ -123,7 +125,7 @@ namespace ts {
}
export function createGetSymbolAccessibilityDiagnosticForNode(node: DeclarationDiagnosticProducing): (symbolAccessibilityResult: SymbolAccessibilityResult) => SymbolAccessibilityDiagnostic | undefined {
if (isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isBindingElement(node) || isConstructorDeclaration(node)) {
if (isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isPropertyAccessExpression(node) || isBindingElement(node) || isConstructorDeclaration(node)) {
return getVariableDeclarationTypeVisibilityError;
}
else if (isSetAccessor(node) || isGetAccessor(node)) {
@@ -164,7 +166,7 @@ namespace ts {
}
// This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit
// The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all.
else if (node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertySignature ||
else if (node.kind === SyntaxKind.PropertyDeclaration || node.kind === SyntaxKind.PropertyAccessExpression || node.kind === SyntaxKind.PropertySignature ||
(node.kind === SyntaxKind.Parameter && hasModifier(node.parent, ModifierFlags.Private))) {
// TODO(jfreeman): Deal with computed properties in error reporting.
if (hasModifier(node, ModifierFlags.Static)) {
+37
View File
@@ -0,0 +1,37 @@
/*@internal*/
namespace ts {
export function transformES2019(context: TransformationContext) {
return chainBundle(transformSourceFile);
function transformSourceFile(node: SourceFile) {
if (node.isDeclarationFile) {
return node;
}
return visitEachChild(node, visitor, context);
}
function visitor(node: Node): VisitResult<Node> {
if ((node.transformFlags & TransformFlags.ContainsES2019) === 0) {
return node;
}
switch (node.kind) {
case SyntaxKind.CatchClause:
return visitCatchClause(node as CatchClause);
default:
return visitEachChild(node, visitor, context);
}
}
function visitCatchClause(node: CatchClause): CatchClause {
if (!node.variableDeclaration) {
return updateCatchClause(
node,
createVariableDeclaration(createTempVariable(/*recordTempVariable*/ undefined)),
visitNode(node.block, visitor, isBlock)
);
}
return visitEachChild(node, visitor, context);
}
}
}
-13
View File
@@ -16,22 +16,9 @@ namespace ts {
return node;
}
switch (node.kind) {
case SyntaxKind.CatchClause:
return visitCatchClause(node as CatchClause);
default:
return visitEachChild(node, visitor, context);
}
}
function visitCatchClause(node: CatchClause): CatchClause {
if (!node.variableDeclaration) {
return updateCatchClause(
node,
createVariableDeclaration(createTempVariable(/*recordTempVariable*/ undefined)),
visitNode(node.block, visitor, isBlock)
);
}
return visitEachChild(node, visitor, context);
}
}
}
+1
View File
@@ -31,6 +31,7 @@
"transformers/ts.ts",
"transformers/es2017.ts",
"transformers/es2018.ts",
"transformers/es2019.ts",
"transformers/esnext.ts",
"transformers/jsx.ts",
"transformers/es2016.ts",
+4 -1
View File
@@ -4722,7 +4722,8 @@ namespace ts {
ES2016 = 3,
ES2017 = 4,
ES2018 = 5,
ESNext = 6,
ES2019 = 6,
ESNext = 7,
JSON = 100,
Latest = ESNext,
}
@@ -5136,6 +5137,7 @@ namespace ts {
Super = 1 << 25,
ContainsSuper = 1 << 26,
ContainsES2018 = 1 << 27,
ContainsES2019 = 1 << 28,
// Please leave this as 1 << 29.
// It is the maximum bit we can set before we outgrow the size of a v8 small integer (SMI) on an x86 system.
@@ -5147,6 +5149,7 @@ namespace ts {
AssertTypeScript = TypeScript | ContainsTypeScript,
AssertJsx = ContainsJsx,
AssertESNext = ContainsESNext,
AssertES2019 = ContainsES2019,
AssertES2018 = ContainsES2018,
AssertES2017 = ContainsES2017,
AssertES2016 = ContainsES2016,
+2
View File
@@ -4608,6 +4608,8 @@ namespace ts {
switch (options.target) {
case ScriptTarget.ESNext:
return "lib.esnext.full.d.ts";
case ScriptTarget.ES2019:
return "lib.es2019.full.d.ts";
case ScriptTarget.ES2018:
return "lib.es2018.full.d.ts";
case ScriptTarget.ES2017:
+1
View File
@@ -56,6 +56,7 @@ namespace evaluator {
}
const evaluateText = `(function (module, exports, require, __dirname, __filename, ${globalNames.join(", ")}) { ${output.text} })`;
// tslint:disable-next-line:no-eval
const evaluateThunk = eval(evaluateText) as (module: any, exports: any, require: (id: string) => any, dirname: string, filename: string, ...globalArgs: any[]) => void;
const module: { exports: any; } = { exports: {} };
evaluateThunk.call(globals, module, module.exports, noRequire, vpath.dirname(output.file), output.file, FakeSymbol, ...globalArgs);
+1
View File
@@ -3159,6 +3159,7 @@ ${code}
const debug = new FourSlashInterface.Debug(state);
const format = new FourSlashInterface.Format(state);
const cancellation = new FourSlashInterface.Cancellation(state);
// tslint:disable-next-line:no-eval
const f = eval(wrappedCode);
f(test, goTo, plugins, verify, edit, debug, format, cancellation, FourSlashInterface.Classification, FourSlashInterface.Completion, verifyOperationIsCancelled);
}
+1
View File
@@ -77,6 +77,7 @@ namespace Utils {
const environment = getExecutionEnvironment();
switch (environment) {
case ExecutionEnvironment.Browser:
// tslint:disable-next-line:no-eval
eval(fileContents);
break;
case ExecutionEnvironment.Node:
+1
View File
@@ -766,6 +766,7 @@ namespace Harness.LanguageService {
}
setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): any {
// tslint:disable-next-line:ban
return setTimeout(callback, ms, args);
}
+4
View File
@@ -0,0 +1,4 @@
/// <reference lib="es2018" />
/// <reference lib="es2019.array" />
/// <reference lib="es2019.string" />
/// <reference lib="es2019.symbol" />
+5
View File
@@ -0,0 +1,5 @@
/// <reference lib="es2019" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />
/// <reference lib="scripthost" />
/// <reference lib="dom.iterable" />
+13
View File
@@ -0,0 +1,13 @@
interface String {
/** Removes the trailing white space and line terminator characters from a string. */
trimEnd(): string;
/** Removes the leading white space and line terminator characters from a string. */
trimStart(): string;
/** Removes the trailing white space and line terminator characters from a string. */
trimLeft(): string;
/** Removes the leading white space and line terminator characters from a string. */
trimRight(): string;
}
+1 -3
View File
@@ -1,5 +1,3 @@
/// <reference lib="es2018" />
/// <reference lib="esnext.array" />
/// <reference lib="es2019" />
/// <reference lib="esnext.bigint" />
/// <reference lib="esnext.symbol" />
/// <reference lib="esnext.intl" />
+5 -2
View File
@@ -6,6 +6,7 @@
"es2016",
"es2017",
"es2018",
"es2019",
"esnext",
// Host only
"dom.generated",
@@ -33,9 +34,10 @@
"es2018.regexp",
"es2018.promise",
"es2018.intl",
"esnext.array",
"es2019.array",
"es2019.string",
"es2019.symbol",
"esnext.bigint",
"esnext.symbol",
"esnext.intl",
// Default libraries
"es5.full",
@@ -43,6 +45,7 @@
"es2016.full",
"es2017.full",
"es2018.full",
"es2019.full",
"esnext.full"
],
"paths": {
-32
View File
@@ -7,7 +7,6 @@ namespace ts.server {
export const ProjectsUpdatedInBackgroundEvent = "projectsUpdatedInBackground";
export const ProjectLoadingStartEvent = "projectLoadingStart";
export const ProjectLoadingFinishEvent = "projectLoadingFinish";
export const SurveyReady = "surveyReady";
export const LargeFileReferencedEvent = "largeFileReferenced";
export const ConfigFileDiagEvent = "configFileDiag";
export const ProjectLanguageServiceStateEvent = "projectLanguageServiceState";
@@ -30,11 +29,6 @@ namespace ts.server {
data: { project: Project; };
}
export interface SurveyReady {
eventName: typeof SurveyReady;
data: { surveyId: string; };
}
export interface LargeFileReferencedEvent {
eventName: typeof LargeFileReferencedEvent;
data: { file: string; fileSize: number; maxFileSize: number; };
@@ -146,7 +140,6 @@ namespace ts.server {
}
export type ProjectServiceEvent = LargeFileReferencedEvent |
SurveyReady |
ProjectsUpdatedInBackgroundEvent |
ProjectLoadingStartEvent |
ProjectLoadingFinishEvent |
@@ -518,9 +511,6 @@ namespace ts.server {
/** Tracks projects that we have already sent telemetry for. */
private readonly seenProjects = createMap<true>();
/** Tracks projects that we have already sent survey events for. */
private readonly seenSurveyProjects = createMap<true>();
/*@internal*/
readonly watchFactory: WatchFactory<WatchType, Project>;
@@ -722,14 +712,6 @@ namespace ts.server {
this.eventHandler(event);
}
/* @internal */
sendSurveyReadyEvent(surveyId: string) {
if (!this.eventHandler) {
return;
}
this.eventHandler({ eventName: SurveyReady, data: { surveyId } });
}
/* @internal */
sendLargeFileReferencedEvent(file: string, fileSize: number) {
if (!this.eventHandler) {
@@ -1611,20 +1593,6 @@ namespace ts.server {
return project;
}
/*@internal*/
sendSurveyReady(project: ExternalProject | ConfiguredProject): void {
if (this.seenSurveyProjects.has(project.projectName)) {
return;
}
if (project.getCompilerOptions().checkJs !== undefined) {
const name = "checkJs";
this.logger.info(`Survey ${name} is ready`);
this.sendSurveyReadyEvent(name);
this.seenSurveyProjects.set(project.projectName, true);
}
}
/*@internal*/
sendProjectTelemetry(project: ExternalProject | ConfiguredProject): void {
if (this.seenProjects.has(project.projectName)) {
-2
View File
@@ -1431,7 +1431,6 @@ namespace ts.server {
}
this.projectService.sendProjectLoadingFinishEvent(this);
this.projectService.sendProjectTelemetry(this);
this.projectService.sendSurveyReady(this);
return result;
}
@@ -1627,7 +1626,6 @@ namespace ts.server {
updateGraph() {
const result = super.updateGraph();
this.projectService.sendProjectTelemetry(this);
this.projectService.sendSurveyReady(this);
return result;
}
-4
View File
@@ -610,10 +610,6 @@ namespace ts.server {
diagnostics: bakedDiags
}, ConfigFileDiagEvent);
break;
case SurveyReady:
const { surveyId } = event.data;
this.event<protocol.SurveyReadyEventBody>({ surveyId }, SurveyReady);
break;
case ProjectLanguageServiceStateEvent: {
const eventName: protocol.ProjectLanguageServiceStateEventName = ProjectLanguageServiceStateEvent;
this.event<protocol.ProjectLanguageServiceStateEventBody>({
+2
View File
@@ -302,6 +302,7 @@ namespace Harness.Parallel.Host {
worker.timer = undefined;
}
else {
// tslint:disable-next-line:ban
worker.timer = setTimeout(killChild, data.payload.duration, data.payload);
}
break;
@@ -623,6 +624,7 @@ namespace Harness.Parallel.Host {
shimNoopTestInterface(global);
}
// tslint:disable-next-line:ban
setTimeout(() => startDelayed(perfData, totalCost), 0); // Do real startup on next tick, so all unit tests have been collected
}
}
-1
View File
@@ -117,7 +117,6 @@
"unittests/tsserver/events/projectLanguageServiceState.ts",
"unittests/tsserver/events/projectLoading.ts",
"unittests/tsserver/events/projectUpdatedInBackground.ts",
"unittests/tsserver/events/surveyReady.ts",
"unittests/tsserver/externalProjects.ts",
"unittests/tsserver/forceConsistentCasingInFileNames.ts",
"unittests/tsserver/formatSettings.ts",
@@ -57,7 +57,7 @@ namespace ts {
assertParseResult(["--lib", "es5,invalidOption", "0.ts"],
{
errors: [{
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.string', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
file: undefined,
@@ -161,7 +161,7 @@ namespace ts {
start: undefined,
length: undefined,
}, {
messageText: "Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'esnext'.",
messageText: "Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext'.",
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
@@ -259,7 +259,7 @@ namespace ts {
assertParseResult(["--lib", "es5,", "es7", "0.ts"],
{
errors: [{
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.string', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
file: undefined,
@@ -278,7 +278,7 @@ namespace ts {
assertParseResult(["--lib", "es5, ", "es7", "0.ts"],
{
errors: [{
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
messageText: "Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.string', 'es2019.symbol', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint'.",
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category,
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
file: undefined,
@@ -238,7 +238,7 @@ namespace ts {
file: undefined,
start: 0,
length: 0,
messageText: "Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'esnext'.",
messageText: "Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'esnext'.",
code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code,
category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category
}]
@@ -1,111 +0,0 @@
namespace ts.projectSystem {
describe("unittests:: tsserver:: events:: SurveyReady", () => {
function createSessionWithEventHandler(host: TestServerHost) {
const { session, events: surveyEvents } = createSessionWithEventTracking<server.SurveyReady>(host, server.SurveyReady);
return { session, verifySurveyReadyEvent };
function verifySurveyReadyEvent(numberOfEvents: number) {
assert.equal(surveyEvents.length, numberOfEvents);
const expectedEvents = numberOfEvents === 0 ? [] : [{
eventName: server.SurveyReady,
data: { surveyId: "checkJs" }
}];
assert.deepEqual(surveyEvents, expectedEvents);
}
}
it("doesn't log an event when checkJs isn't set", () => {
const projectRoot = "/user/username/projects/project";
const file: File = {
path: `${projectRoot}/src/file.ts`,
content: "export var y = 10;"
};
const tsconfig: File = {
path: `${projectRoot}/tsconfig.json`,
content: JSON.stringify({ compilerOptions: {} }),
};
const host = createServerHost([file, tsconfig]);
const { session, verifySurveyReadyEvent } = createSessionWithEventHandler(host);
const service = session.getProjectService();
openFilesForSession([file], session);
checkNumberOfProjects(service, { configuredProjects: 1 });
const project = service.configuredProjects.get(tsconfig.path)!;
checkProjectActualFiles(project, [file.path, tsconfig.path]);
verifySurveyReadyEvent(0);
});
it("logs an event when checkJs is set", () => {
const projectRoot = "/user/username/projects/project";
const file: File = {
path: `${projectRoot}/src/file.ts`,
content: "export var y = 10;"
};
const tsconfig: File = {
path: `${projectRoot}/tsconfig.json`,
content: JSON.stringify({ compilerOptions: { checkJs: true } }),
};
const host = createServerHost([file, tsconfig]);
const { session, verifySurveyReadyEvent } = createSessionWithEventHandler(host);
openFilesForSession([file], session);
verifySurveyReadyEvent(1);
});
it("logs an event when checkJs is set, only the first time", () => {
const projectRoot = "/user/username/projects/project";
const file: File = {
path: `${projectRoot}/src/file.ts`,
content: "export var y = 10;"
};
const rando: File = {
path: `/rando/calrissian.ts`,
content: "export function f() { }"
};
const tsconfig: File = {
path: `${projectRoot}/tsconfig.json`,
content: JSON.stringify({ compilerOptions: { checkJs: true } }),
};
const host = createServerHost([file, tsconfig]);
const { session, verifySurveyReadyEvent } = createSessionWithEventHandler(host);
openFilesForSession([file], session);
verifySurveyReadyEvent(1);
closeFilesForSession([file], session);
openFilesForSession([rando], session);
openFilesForSession([file], session);
verifySurveyReadyEvent(1);
});
it("logs an event when checkJs is set after closing and reopening", () => {
const projectRoot = "/user/username/projects/project";
const file: File = {
path: `${projectRoot}/src/file.ts`,
content: "export var y = 10;"
};
const rando: File = {
path: `/rando/calrissian.ts`,
content: "export function f() { }"
};
const tsconfig: File = {
path: `${projectRoot}/tsconfig.json`,
content: JSON.stringify({}),
};
const host = createServerHost([file, tsconfig]);
const { session, verifySurveyReadyEvent } = createSessionWithEventHandler(host);
openFilesForSession([file], session);
verifySurveyReadyEvent(0);
closeFilesForSession([file], session);
openFilesForSession([rando], session);
host.writeFile(tsconfig.path, JSON.stringify({ compilerOptions: { checkJs: true } }));
openFilesForSession([file], session);
verifySurveyReadyEvent(1);
});
});
}
+1
View File
@@ -705,6 +705,7 @@ namespace ts.server {
// stat due to inconsistencies of fs.watch
// and efficiency of stat on modern filesystems
function startWatchTimer() {
// tslint:disable-next-line:ban
setInterval(() => {
let count = 0;
let nextToCheck = nextFileToCheck;