mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Get codebase building pre bundling
This isn't totally complete, but enough to get everything building and tests running manually. The next commit will make the build work fully.
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
/// <reference types="node"/>
|
||||
|
||||
import * as fs from "fs";
|
||||
|
||||
interface ServerCancellationToken {
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
{
|
||||
"extends": "../tsconfig-noncomposite-base",
|
||||
"extends": "../tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../built/local/",
|
||||
"rootDir": ".",
|
||||
"composite": false,
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
"removeComments": true,
|
||||
"incremental": false,
|
||||
"outDir": "../../built/local/cancellationToken",
|
||||
"module": "commonjs",
|
||||
"types": [
|
||||
"node"
|
||||
@@ -16,7 +10,5 @@
|
||||
"es6"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"cancellationToken.ts"
|
||||
]
|
||||
"include": ["**/*"]
|
||||
}
|
||||
|
||||
@@ -1521,7 +1521,14 @@ export let sys: System = (() => {
|
||||
}
|
||||
},
|
||||
getExecutingFilePath() {
|
||||
return __filename;
|
||||
// This function previously returned a path like `built/local/tsc.js`.
|
||||
// Now, with a module output, this file is now `built/local/compiler/sys.js`.
|
||||
// We want to return a file that looks like the old one, so that callers
|
||||
// can locate other assets like the lib.d.ts files.
|
||||
//
|
||||
// TODO(jakebailey): replace this function with one that returns the path
|
||||
// to the lib folder (or package path)?.
|
||||
return _path.join(_path.dirname(__dirname), "fake.js");
|
||||
},
|
||||
getCurrentDirectory,
|
||||
getDirectories,
|
||||
|
||||
@@ -1,88 +1,12 @@
|
||||
{
|
||||
"extends": "../tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../built/local",
|
||||
"outDir": "../../built/local/compiler",
|
||||
"types": ["node"]
|
||||
},
|
||||
|
||||
"references": [
|
||||
],
|
||||
|
||||
"files": [
|
||||
"corePublic.ts",
|
||||
"core.ts",
|
||||
"debug.ts",
|
||||
"semver.ts",
|
||||
"performanceCore.ts",
|
||||
"performance.ts",
|
||||
"perfLogger.ts",
|
||||
"tracing.ts",
|
||||
|
||||
"types.ts",
|
||||
"sys.ts",
|
||||
"path.ts",
|
||||
"diagnosticInformationMap.generated.ts",
|
||||
"scanner.ts",
|
||||
"utilitiesPublic.ts",
|
||||
"utilities.ts",
|
||||
"factory/baseNodeFactory.ts",
|
||||
"factory/parenthesizerRules.ts",
|
||||
"factory/nodeConverters.ts",
|
||||
"factory/nodeFactory.ts",
|
||||
"factory/emitNode.ts",
|
||||
"factory/emitHelpers.ts",
|
||||
"factory/nodeTests.ts",
|
||||
"factory/utilities.ts",
|
||||
"factory/utilitiesPublic.ts",
|
||||
"parser.ts",
|
||||
"commandLineParser.ts",
|
||||
"moduleNameResolver.ts",
|
||||
|
||||
"binder.ts",
|
||||
"symbolWalker.ts",
|
||||
"checker.ts",
|
||||
"visitorPublic.ts",
|
||||
"sourcemap.ts",
|
||||
"transformers/utilities.ts",
|
||||
"transformers/destructuring.ts",
|
||||
"transformers/taggedTemplate.ts",
|
||||
"transformers/ts.ts",
|
||||
"transformers/classFields.ts",
|
||||
"transformers/typeSerializer.ts",
|
||||
"transformers/legacyDecorators.ts",
|
||||
"transformers/es2017.ts",
|
||||
"transformers/es2018.ts",
|
||||
"transformers/es2019.ts",
|
||||
"transformers/es2020.ts",
|
||||
"transformers/es2021.ts",
|
||||
"transformers/esnext.ts",
|
||||
"transformers/jsx.ts",
|
||||
"transformers/es2016.ts",
|
||||
"transformers/es2015.ts",
|
||||
"transformers/es5.ts",
|
||||
"transformers/generators.ts",
|
||||
"transformers/module/module.ts",
|
||||
"transformers/module/system.ts",
|
||||
"transformers/module/esnextAnd2015.ts",
|
||||
"transformers/module/node.ts",
|
||||
"transformers/declarations/diagnostics.ts",
|
||||
"transformers/declarations.ts",
|
||||
"transformer.ts",
|
||||
"emitter.ts",
|
||||
"watchUtilities.ts",
|
||||
"program.ts",
|
||||
"builderStatePublic.ts",
|
||||
"builderState.ts",
|
||||
"builder.ts",
|
||||
"builderPublic.ts",
|
||||
"resolutionCache.ts",
|
||||
"moduleSpecifiers.ts",
|
||||
"watch.ts",
|
||||
"watchPublic.ts",
|
||||
"tsbuild.ts",
|
||||
"tsbuildPublic.ts",
|
||||
"_namespaces/ts.ts",
|
||||
"_namespaces/ts.moduleSpecifiers.ts",
|
||||
"_namespaces/ts.performance.ts"
|
||||
]
|
||||
"include": ["**/*"]
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../built/local/release",
|
||||
"removeComments": true,
|
||||
"preserveConstEnums": false
|
||||
},
|
||||
"references": [
|
||||
]
|
||||
}
|
||||
@@ -1,14 +1,9 @@
|
||||
{
|
||||
"extends": "../tsconfig-library-base",
|
||||
"extends": "../tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"target": "es2019",
|
||||
"lib": ["es2019"],
|
||||
"outDir": "../../built/local",
|
||||
"declaration": false,
|
||||
"sourceMap": true
|
||||
"outDir": "../../built/local/debug"
|
||||
},
|
||||
"files": [
|
||||
"dbg.ts",
|
||||
"_namespaces/Debug.ts"
|
||||
]
|
||||
"include": ["**/*"]
|
||||
}
|
||||
|
||||
@@ -1,22 +1,10 @@
|
||||
{
|
||||
"extends": "../tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../built/local",
|
||||
"experimentalDecorators": true
|
||||
"outDir": "../../built/local/deprecatedCompat"
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../compiler" }
|
||||
],
|
||||
"files": [
|
||||
"deprecations.ts",
|
||||
"4.0/nodeFactoryTopLevelExports.ts",
|
||||
"4.0/renamedNodeTests.ts",
|
||||
"4.0/renamedMapInterfaces.ts",
|
||||
"4.2/renamedNodeTests.ts",
|
||||
"4.2/abstractConstructorTypes.ts",
|
||||
"4.6/importTypeAssertions.ts",
|
||||
"4.7/typeParameterModifiers.ts",
|
||||
"4.8/mergeDecoratorsAndModifiers.ts",
|
||||
"_namespaces/ts.ts"
|
||||
]
|
||||
}
|
||||
"include": ["**/*"]
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
{
|
||||
"extends": "../tsconfig-library-base",
|
||||
"extends": "../tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../built/local",
|
||||
"outDir": "../../built/local/dynamicImportCompat",
|
||||
"rootDir": ".",
|
||||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"lib": ["esnext"],
|
||||
"declaration": false,
|
||||
"sourceMap": true,
|
||||
"tsBuildInfoFile": "../../built/local/dynamicImportCompat.tsbuildinfo"
|
||||
"lib": ["esnext"]
|
||||
},
|
||||
"files": [
|
||||
"dynamicImportCompat.ts",
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
{
|
||||
"extends": "../tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../built/local"
|
||||
"outDir": "../../built/local/executeCommandLine"
|
||||
},
|
||||
|
||||
"references": [
|
||||
{ "path": "../compiler" }
|
||||
],
|
||||
|
||||
"files": [
|
||||
"executeCommandLine.ts",
|
||||
"_namespaces/ts.ts"
|
||||
]
|
||||
"include": ["**/*"]
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../built/local/release",
|
||||
"removeComments": true,
|
||||
"preserveConstEnums": false
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../compiler/tsconfig.release.json" }
|
||||
]
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"extends": "../tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../built/local",
|
||||
"outDir": "../../built/local/harness",
|
||||
"types": [
|
||||
"node", "mocha", "chai"
|
||||
],
|
||||
@@ -19,43 +19,5 @@
|
||||
{ "path": "../deprecatedCompat" },
|
||||
],
|
||||
|
||||
"files": [
|
||||
"collectionsImpl.ts",
|
||||
"util.ts",
|
||||
"documentsUtil.ts",
|
||||
"vpathUtil.ts",
|
||||
"vfsUtil.ts",
|
||||
"compilerImpl.ts",
|
||||
"evaluatorImpl.ts",
|
||||
"fakesHosts.ts",
|
||||
"client.ts",
|
||||
"findUpDir.ts",
|
||||
|
||||
"runnerbase.ts",
|
||||
"sourceMapRecorder.ts",
|
||||
"harnessGlobals.ts",
|
||||
"harnessUtils.ts",
|
||||
"harnessIO.ts",
|
||||
"harnessLanguageService.ts",
|
||||
"virtualFileSystemWithWatch.ts",
|
||||
"fourslashImpl.ts",
|
||||
"fourslashInterfaceImpl.ts",
|
||||
"typeWriter.ts",
|
||||
"_namespaces/ts.server.ts",
|
||||
"_namespaces/ts.ts",
|
||||
"_namespaces/collections.ts",
|
||||
"_namespaces/compiler.ts",
|
||||
"_namespaces/documents.ts",
|
||||
"_namespaces/evaluator.ts",
|
||||
"_namespaces/fakes.ts",
|
||||
"_namespaces/Utils.ts",
|
||||
"_namespaces/FourSlash.ts",
|
||||
"_namespaces/FourSlashInterface.ts",
|
||||
"_namespaces/Harness.ts",
|
||||
"_namespaces/Harness.LanguageService.ts",
|
||||
"_namespaces/Harness.SourceMapRecorder.ts",
|
||||
"_namespaces/vfs.ts",
|
||||
"_namespaces/ts.TestFSWithWatch.ts",
|
||||
"_namespaces/vpath.ts"
|
||||
]
|
||||
"include": ["**/*"]
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"extends": "../tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../built/local",
|
||||
"outDir": "../../built/local/jsTyping",
|
||||
"types": [
|
||||
"node"
|
||||
],
|
||||
@@ -13,12 +13,5 @@
|
||||
"references": [
|
||||
{ "path": "../compiler" }
|
||||
],
|
||||
"files": [
|
||||
"shared.ts",
|
||||
"types.ts",
|
||||
"jsTyping.ts",
|
||||
"_namespaces/ts.JsTyping.ts",
|
||||
"_namespaces/ts.ts",
|
||||
"_namespaces/ts.server.ts"
|
||||
]
|
||||
"include": ["**/*"]
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"extends": "../tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../built/local",
|
||||
"outDir": "../../built/local/loggedIO",
|
||||
"types": [
|
||||
],
|
||||
"lib": [
|
||||
@@ -18,11 +18,5 @@
|
||||
{ "path": "../harness" },
|
||||
],
|
||||
|
||||
"files": [
|
||||
"loggedIO.ts",
|
||||
"_namespaces/Playback.ts",
|
||||
"_namespaces/ts.server.ts",
|
||||
"_namespaces/ts.ts",
|
||||
"_namespaces/Harness.ts"
|
||||
]
|
||||
"include": ["**/*"]
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ export * from "../../jsTyping/_namespaces/ts.server";
|
||||
export * from "../types";
|
||||
export * from "../utilitiesPublic";
|
||||
export * from "../utilities";
|
||||
import * as protocol from "./ts.server.protocol";
|
||||
export { protocol };
|
||||
export * from "../scriptInfo";
|
||||
export * from "../typingsCache";
|
||||
export * from "../project";
|
||||
@@ -12,5 +14,3 @@ export * from "../moduleSpecifierCache";
|
||||
export * from "../packageJsonCache";
|
||||
export * from "../session";
|
||||
export * from "../scriptVersionCache";
|
||||
import * as protocol from "./ts.server.protocol";
|
||||
export { protocol };
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
{
|
||||
"extends": "../tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"removeComments": false,
|
||||
"outDir": "../../built/local",
|
||||
"preserveConstEnums": true,
|
||||
"outDir": "../../built/local/server",
|
||||
"types": [
|
||||
"node"
|
||||
]
|
||||
@@ -13,21 +11,5 @@
|
||||
{ "path": "../jsTyping" },
|
||||
{ "path": "../services" }
|
||||
],
|
||||
"files": [
|
||||
"types.ts",
|
||||
"utilitiesPublic.ts",
|
||||
"utilities.ts",
|
||||
"protocol.ts",
|
||||
"scriptInfo.ts",
|
||||
"typingsCache.ts",
|
||||
"project.ts",
|
||||
"editorServices.ts",
|
||||
"moduleSpecifierCache.ts",
|
||||
"packageJsonCache.ts",
|
||||
"session.ts",
|
||||
"scriptVersionCache.ts",
|
||||
"_namespaces/ts.server.ts",
|
||||
"_namespaces/ts.ts",
|
||||
"_namespaces/ts.server.protocol.ts"
|
||||
]
|
||||
"include": ["**/*"]
|
||||
}
|
||||
|
||||
@@ -1,172 +1,11 @@
|
||||
{
|
||||
"extends": "../tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../built/local"
|
||||
"outDir": "../../built/local/services"
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../compiler" },
|
||||
{ "path": "../jsTyping" }
|
||||
],
|
||||
"files": [
|
||||
"types.ts",
|
||||
"utilities.ts",
|
||||
"exportInfoMap.ts",
|
||||
"classifier.ts",
|
||||
"classifier2020.ts",
|
||||
"stringCompletions.ts",
|
||||
"completions.ts",
|
||||
"documentHighlights.ts",
|
||||
"documentRegistry.ts",
|
||||
"importTracker.ts",
|
||||
"findAllReferences.ts",
|
||||
"callHierarchy.ts",
|
||||
"getEditsForFileRename.ts",
|
||||
"goToDefinition.ts",
|
||||
"jsDoc.ts",
|
||||
"navigateTo.ts",
|
||||
"navigationBar.ts",
|
||||
"organizeImports.ts",
|
||||
"getEditsForFileRename.ts",
|
||||
"outliningElementsCollector.ts",
|
||||
"patternMatcher.ts",
|
||||
"preProcess.ts",
|
||||
"rename.ts",
|
||||
"smartSelection.ts",
|
||||
"signatureHelp.ts",
|
||||
"inlayHints.ts",
|
||||
"sourcemaps.ts",
|
||||
"suggestionDiagnostics.ts",
|
||||
"symbolDisplay.ts",
|
||||
"transpile.ts",
|
||||
"formatting/formattingContext.ts",
|
||||
"formatting/formattingScanner.ts",
|
||||
"formatting/rule.ts",
|
||||
"formatting/rules.ts",
|
||||
"formatting/rulesMap.ts",
|
||||
"formatting/formatting.ts",
|
||||
"formatting/smartIndenter.ts",
|
||||
"textChanges.ts",
|
||||
"codeFixProvider.ts",
|
||||
"refactorProvider.ts",
|
||||
"codefixes/addConvertToUnknownForNonOverlappingTypes.ts",
|
||||
"codefixes/addEmptyExportDeclaration.ts",
|
||||
"codefixes/addMissingAsync.ts",
|
||||
"codefixes/addMissingAwait.ts",
|
||||
"codefixes/addMissingConst.ts",
|
||||
"codefixes/addMissingDeclareProperty.ts",
|
||||
"codefixes/addMissingInvocationForDecorator.ts",
|
||||
"codefixes/addNameToNamelessParameter.ts",
|
||||
"codefixes/addOptionalPropertyUndefined.ts",
|
||||
"codefixes/annotateWithTypeFromJSDoc.ts",
|
||||
"codefixes/convertFunctionToEs6Class.ts",
|
||||
"codefixes/convertToAsyncFunction.ts",
|
||||
"codefixes/convertToEsModule.ts",
|
||||
"codefixes/correctQualifiedNameToIndexedAccessType.ts",
|
||||
"codefixes/convertToTypeOnlyExport.ts",
|
||||
"codefixes/convertToTypeOnlyImport.ts",
|
||||
"codefixes/convertLiteralTypeToMappedType.ts",
|
||||
"codefixes/fixClassIncorrectlyImplementsInterface.ts",
|
||||
"codefixes/importFixes.ts",
|
||||
"codefixes/fixAddMissingConstraint.ts",
|
||||
"codefixes/fixOverrideModifier.ts",
|
||||
"codefixes/fixNoPropertyAccessFromIndexSignature.ts",
|
||||
"codefixes/fixImplicitThis.ts",
|
||||
"codefixes/fixImportNonExportedMember.ts",
|
||||
"codefixes/fixIncorrectNamedTupleSyntax.ts",
|
||||
"codefixes/fixSpelling.ts",
|
||||
"codefixes/returnValueCorrect.ts",
|
||||
"codefixes/fixAddMissingMember.ts",
|
||||
"codefixes/fixAddMissingNewOperator.ts",
|
||||
"codefixes/fixCannotFindModule.ts",
|
||||
"codefixes/fixClassDoesntImplementInheritedAbstractMember.ts",
|
||||
"codefixes/fixClassSuperMustPrecedeThisAccess.ts",
|
||||
"codefixes/fixConstructorForDerivedNeedSuperCall.ts",
|
||||
"codefixes/fixEnableExperimentalDecorators.ts",
|
||||
"codefixes/fixEnableJsxFlag.ts",
|
||||
"codefixes/fixNaNEquality.ts",
|
||||
"codefixes/fixModuleAndTargetOptions.ts",
|
||||
"codefixes/fixPropertyAssignment.ts",
|
||||
"codefixes/fixExtendsInterfaceBecomesImplements.ts",
|
||||
"codefixes/fixForgottenThisPropertyAccess.ts",
|
||||
"codefixes/fixInvalidJsxCharacters.ts",
|
||||
"codefixes/fixUnmatchedParameter.ts",
|
||||
"codefixes/fixUnreferenceableDecoratorMetadata.ts",
|
||||
"codefixes/fixUnusedIdentifier.ts",
|
||||
"codefixes/fixUnreachableCode.ts",
|
||||
"codefixes/fixUnusedLabel.ts",
|
||||
"codefixes/fixJSDocTypes.ts",
|
||||
"codefixes/fixMissingCallParentheses.ts",
|
||||
"codefixes/fixAwaitInSyncFunction.ts",
|
||||
"codefixes/fixPropertyOverrideAccessor.ts",
|
||||
"codefixes/inferFromUsage.ts",
|
||||
"codefixes/fixReturnTypeInAsyncFunction.ts",
|
||||
"codefixes/disableJsDiagnostics.ts",
|
||||
"codefixes/helpers.ts",
|
||||
"codefixes/generateAccessors.ts",
|
||||
"codefixes/fixInvalidImportSyntax.ts",
|
||||
"codefixes/fixStrictClassInitialization.ts",
|
||||
"codefixes/requireInTs.ts",
|
||||
"codefixes/useDefaultImport.ts",
|
||||
"codefixes/useBigintLiteral.ts",
|
||||
"codefixes/fixAddModuleReferTypeMissingTypeof.ts",
|
||||
"codefixes/wrapJsxInFragment.ts",
|
||||
"codefixes/convertToMappedObjectType.ts",
|
||||
"codefixes/removeAccidentalCallParentheses.ts",
|
||||
"codefixes/removeUnnecessaryAwait.ts",
|
||||
"codefixes/splitTypeOnlyImport.ts",
|
||||
"codefixes/convertConstToLet.ts",
|
||||
"codefixes/fixExpectedComma.ts",
|
||||
"codefixes/fixAddVoidToPromise.ts",
|
||||
"refactors/convertExport.ts",
|
||||
"refactors/convertImport.ts",
|
||||
"refactors/convertToOptionalChainExpression.ts",
|
||||
"refactors/convertOverloadListToSingleSignature.ts",
|
||||
"refactors/extractSymbol.ts",
|
||||
"refactors/extractType.ts",
|
||||
"refactors/generateGetAccessorAndSetAccessor.ts",
|
||||
"refactors/helpers.ts",
|
||||
"refactors/moveToNewFile.ts",
|
||||
"refactors/addOrRemoveBracesToArrowFunction.ts",
|
||||
"refactors/convertParamsToDestructuredObject.ts",
|
||||
"refactors/convertStringOrTemplateLiteral.ts",
|
||||
"refactors/convertArrowFunctionOrFunctionExpression.ts",
|
||||
"refactors/inferFunctionReturnType.ts",
|
||||
"services.ts",
|
||||
"breakpoints.ts",
|
||||
"transform.ts",
|
||||
"shims.ts",
|
||||
"globalThisShim.ts",
|
||||
"exportAsModule.ts",
|
||||
"_namespaces/ts.BreakpointResolver.ts",
|
||||
"_namespaces/ts.ts",
|
||||
"_namespaces/ts.CallHierarchy.ts",
|
||||
"_namespaces/ts.classifier.v2020.ts",
|
||||
"_namespaces/ts.classifier.ts",
|
||||
"_namespaces/ts.codefix.ts",
|
||||
"_namespaces/ts.Completions.ts",
|
||||
"_namespaces/ts.FindAllReferences.ts",
|
||||
"_namespaces/ts.GoToDefinition.ts",
|
||||
"_namespaces/ts.InlayHints.ts",
|
||||
"_namespaces/ts.JsDoc.ts",
|
||||
"_namespaces/ts.NavigateTo.ts",
|
||||
"_namespaces/ts.NavigationBar.ts",
|
||||
"_namespaces/ts.OrganizeImports.ts",
|
||||
"_namespaces/ts.OutliningElementsCollector.ts",
|
||||
"_namespaces/ts.refactor.ts",
|
||||
"_namespaces/ts.Rename.ts",
|
||||
"_namespaces/ts.SignatureHelp.ts",
|
||||
"_namespaces/ts.SmartSelectionRange.ts",
|
||||
"_namespaces/ts.Completions.StringCompletions.ts",
|
||||
"_namespaces/ts.SymbolDisplay.ts",
|
||||
"_namespaces/ts.textChanges.ts",
|
||||
"_namespaces/ts.formatting.ts",
|
||||
"_namespaces/ts.refactor.addOrRemoveBracesToArrowFunction.ts",
|
||||
"_namespaces/ts.refactor.convertArrowFunctionOrFunctionExpression.ts",
|
||||
"_namespaces/ts.refactor.convertParamsToDestructuredObject.ts",
|
||||
"_namespaces/ts.refactor.convertStringOrTemplateLiteral.ts",
|
||||
"_namespaces/ts.refactor.convertToOptionalChainExpression.ts",
|
||||
"_namespaces/ts.refactor.extractSymbol.ts",
|
||||
"_namespaces/ts.refactor.generateGetAccessorAndSetAccessor.ts",
|
||||
"_namespaces/ts.refactor.inferFunctionReturnType.ts"
|
||||
]
|
||||
"include": ["**/*"]
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* Generated file to emulate the FourSlash namespace. */
|
||||
|
||||
export * from "../../harness/_namespaces/FourSlash";
|
||||
export * from "../fourslashRef";
|
||||
|
||||
@@ -2,10 +2,17 @@
|
||||
|
||||
export * from "../../harness/_namespaces/Harness";
|
||||
export * from "../../loggedIO/_namespaces/Harness";
|
||||
|
||||
import * as Parallel from "./Harness.Parallel";
|
||||
export { Parallel };
|
||||
|
||||
export * from "../fourslashRunner";
|
||||
export * from "../compilerRunner";
|
||||
export * from "../externalCompileRunner";
|
||||
export * from "../test262Runner";
|
||||
export * from "../runner";
|
||||
import * as Parallel from "./Harness.Parallel";
|
||||
export { Parallel };
|
||||
|
||||
// If running bundled, we want this to be here so that esbuild places the tests after runner.ts.
|
||||
if (!__filename.endsWith("Harness.js")) {
|
||||
require("../tests");
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* Generated file to emulate the Playback namespace. */
|
||||
|
||||
export * from "../../loggedIO/_namespaces/Playback";
|
||||
export * from "../playbackRef";
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* Generated file to emulate the Utils namespace. */
|
||||
|
||||
export * from "../../harness/_namespaces/Utils";
|
||||
export * from "../utilsRef";
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* Generated file to emulate the compiler namespace. */
|
||||
|
||||
export * from "../../harness/_namespaces/compiler";
|
||||
export * from "../compilerRef";
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* Generated file to emulate the documents namespace. */
|
||||
|
||||
export * from "../../harness/_namespaces/documents";
|
||||
export * from "../documentsRef";
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* Generated file to emulate the evaluator namespace. */
|
||||
|
||||
export * from "../../harness/_namespaces/evaluator";
|
||||
export * from "../evaluatorRef";
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* Generated file to emulate the fakes namespace. */
|
||||
|
||||
export * from "../../harness/_namespaces/fakes";
|
||||
export * from "../fakesRef";
|
||||
|
||||
@@ -1,69 +1,3 @@
|
||||
/* Generated file to emulate the ts.projectSystem namespace. */
|
||||
|
||||
export * from "../unittests/tsserver/helpers";
|
||||
export * from "../unittests/tsserver/applyChangesToOpenFiles";
|
||||
export * from "../unittests/tsserver/autoImportProvider";
|
||||
export * from "../unittests/tsserver/auxiliaryProject";
|
||||
export * from "../unittests/tsserver/cachingFileSystemInformation";
|
||||
export * from "../unittests/tsserver/cancellationToken";
|
||||
export * from "../unittests/tsserver/compileOnSave";
|
||||
export * from "../unittests/tsserver/completions";
|
||||
export * from "../unittests/tsserver/completionsIncomplete";
|
||||
export * from "../unittests/tsserver/configFileSearch";
|
||||
export * from "../unittests/tsserver/configuredProjects";
|
||||
export * from "../unittests/tsserver/declarationFileMaps";
|
||||
export * from "../unittests/tsserver/documentRegistry";
|
||||
export * from "../unittests/tsserver/duplicatePackages";
|
||||
export * from "../unittests/tsserver/dynamicFiles";
|
||||
export * from "../unittests/tsserver/events/largeFileReferenced";
|
||||
export * from "../unittests/tsserver/events/projectLanguageServiceState";
|
||||
export * from "../unittests/tsserver/events/projectLoading";
|
||||
export * from "../unittests/tsserver/events/projectUpdatedInBackground";
|
||||
export * from "../unittests/tsserver/exportMapCache";
|
||||
export * from "../unittests/tsserver/externalProjects";
|
||||
export * from "../unittests/tsserver/forceConsistentCasingInFileNames";
|
||||
export * from "../unittests/tsserver/formatSettings";
|
||||
export * from "../unittests/tsserver/getApplicableRefactors";
|
||||
export * from "../unittests/tsserver/getEditsForFileRename";
|
||||
export * from "../unittests/tsserver/getExportReferences";
|
||||
export * from "../unittests/tsserver/getFileReferences";
|
||||
export * from "../unittests/tsserver/importHelpers";
|
||||
export * from "../unittests/tsserver/inlayHints";
|
||||
export * from "../unittests/tsserver/inferredProjects";
|
||||
export * from "../unittests/tsserver/jsdocTag";
|
||||
export * from "../unittests/tsserver/languageService";
|
||||
export * from "../unittests/tsserver/maxNodeModuleJsDepth";
|
||||
export * from "../unittests/tsserver/metadataInResponse";
|
||||
export * from "../unittests/tsserver/moduleResolution";
|
||||
export * from "../unittests/tsserver/moduleSpecifierCache";
|
||||
export * from "../unittests/tsserver/navTo";
|
||||
export * from "../unittests/tsserver/occurences";
|
||||
export * from "../unittests/tsserver/openFile";
|
||||
export * from "../unittests/tsserver/packageJsonInfo";
|
||||
export * from "../unittests/tsserver/partialSemanticServer";
|
||||
export * from "../unittests/tsserver/plugins";
|
||||
export * from "../unittests/tsserver/projectErrors";
|
||||
export * from "../unittests/tsserver/projectReferenceCompileOnSave";
|
||||
export * from "../unittests/tsserver/projectReferenceErrors";
|
||||
export * from "../unittests/tsserver/projectReferences";
|
||||
export * from "../unittests/tsserver/projectReferencesSourcemap";
|
||||
export * from "../unittests/tsserver/projects";
|
||||
export * from "../unittests/tsserver/projectsWithReferences";
|
||||
export * from "../unittests/tsserver/refactors";
|
||||
export * from "../unittests/tsserver/reload";
|
||||
export * from "../unittests/tsserver/reloadProjects";
|
||||
export * from "../unittests/tsserver/rename";
|
||||
export * from "../unittests/tsserver/resolutionCache";
|
||||
export * from "../unittests/tsserver/skipLibCheck";
|
||||
export * from "../unittests/tsserver/smartSelection";
|
||||
export * from "../unittests/tsserver/symlinkCache";
|
||||
export * from "../unittests/tsserver/symLinks";
|
||||
export * from "../unittests/tsserver/syntacticServer";
|
||||
export * from "../unittests/tsserver/syntaxOperations";
|
||||
export * from "../unittests/tsserver/telemetry";
|
||||
export * from "../unittests/tsserver/typeAquisition";
|
||||
export * from "../unittests/tsserver/typeOnlyImportChains";
|
||||
export * from "../unittests/tsserver/typeReferenceDirectives";
|
||||
export * from "../unittests/tsserver/typingsInstaller";
|
||||
export * from "../unittests/tsserver/watchEnvironment";
|
||||
export * from "../unittests/tsserver/webServer";
|
||||
|
||||
@@ -6,4 +6,3 @@ export * from "../../webServer/_namespaces/ts.server";
|
||||
export * from "../../typingsInstallerCore/_namespaces/ts.server";
|
||||
export * from "../../harness/_namespaces/ts.server";
|
||||
export * from "../../loggedIO/_namespaces/ts.server";
|
||||
export * from "../unittests/tsserver/session";
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
/* Generated file to emulate the ts.textStorage namespace. */
|
||||
|
||||
export * from "../unittests/tsserver/textStorage";
|
||||
@@ -10,88 +10,13 @@ export * from "../../typingsInstallerCore/_namespaces/ts";
|
||||
export * from "../../deprecatedCompat/_namespaces/ts";
|
||||
export * from "../../harness/_namespaces/ts";
|
||||
export * from "../../loggedIO/_namespaces/ts";
|
||||
import * as tscWatch from "./ts.tscWatch";
|
||||
export { tscWatch };
|
||||
import * as server from "./ts.server";
|
||||
export { server };
|
||||
import * as projectSystem from "./ts.projectSystem";
|
||||
export { projectSystem };
|
||||
export * from "../unittests/helpers";
|
||||
export * from "../unittests/services/extract/helpers";
|
||||
export * from "../unittests/tsbuild/helpers";
|
||||
export * from "../unittests/tsc/helpers";
|
||||
export * from "../unittests/asserts";
|
||||
export * from "../unittests/base64";
|
||||
export * from "../unittests/builder";
|
||||
export * from "../unittests/comments";
|
||||
export * from "../unittests/compilerCore";
|
||||
export * from "../unittests/convertToBase64";
|
||||
export * from "../unittests/customTransforms";
|
||||
export * from "../unittests/factory";
|
||||
export * from "../unittests/incrementalParser";
|
||||
export * from "../unittests/jsDocParsing";
|
||||
export * from "../unittests/jsonParserRecovery";
|
||||
export * from "../unittests/moduleResolution";
|
||||
export * from "../unittests/parsePseudoBigInt";
|
||||
export * from "../unittests/printer";
|
||||
export * from "../unittests/programApi";
|
||||
export * from "../unittests/reuseProgramStructure";
|
||||
export * from "../unittests/semver";
|
||||
export * from "../unittests/transform";
|
||||
export * from "../unittests/config/commandLineParsing";
|
||||
export * from "../unittests/config/configurationExtension";
|
||||
export * from "../unittests/config/convertCompilerOptionsFromJson";
|
||||
export * from "../unittests/config/convertTypeAcquisitionFromJson";
|
||||
export * from "../unittests/config/initializeTSConfig";
|
||||
export * from "../unittests/config/matchFiles";
|
||||
export * from "../unittests/config/projectReferences";
|
||||
export * from "../unittests/config/showConfig";
|
||||
export * from "../unittests/config/tsconfigParsing";
|
||||
export * from "../unittests/config/tsconfigParsingWatchOptions";
|
||||
export * from "../unittests/services/cancellableLanguageServiceOperations";
|
||||
export * from "../unittests/services/convertToAsyncFunction";
|
||||
export * from "../unittests/services/extract/constants";
|
||||
export * from "../unittests/services/extract/functions";
|
||||
export * from "../unittests/services/extract/symbolWalker";
|
||||
export * from "../unittests/services/extract/ranges";
|
||||
export * from "../unittests/services/hostNewLineSupport";
|
||||
export * from "../unittests/services/languageService";
|
||||
export * from "../unittests/services/organizeImports";
|
||||
export * from "../unittests/services/textChanges";
|
||||
export * from "../unittests/services/transpile";
|
||||
export * from "../unittests/tsbuild/amdModulesWithOut";
|
||||
export * from "../unittests/tsbuild/clean";
|
||||
export * from "../unittests/tsbuild/commandLine";
|
||||
export * from "../unittests/tsbuild/configFileErrors";
|
||||
export * from "../unittests/tsbuild/configFileExtends";
|
||||
export * from "../unittests/tsbuild/containerOnlyReferenced";
|
||||
export * from "../unittests/tsbuild/declarationEmit";
|
||||
export * from "../unittests/tsbuild/demo";
|
||||
export * from "../unittests/tsbuild/emitDeclarationOnly";
|
||||
export * from "../unittests/tsbuild/emptyFiles";
|
||||
export * from "../unittests/tsbuild/exitCodeOnBogusFile";
|
||||
export * from "../unittests/tsbuild/graphOrdering";
|
||||
export * from "../unittests/tsbuild/inferredTypeFromTransitiveModule";
|
||||
export * from "../unittests/tsbuild/javascriptProjectEmit";
|
||||
export * from "../unittests/tsbuild/lateBoundSymbol";
|
||||
export * from "../unittests/tsbuild/moduleSpecifiers";
|
||||
export * from "../unittests/tsbuild/noEmit";
|
||||
export * from "../unittests/tsbuild/noEmitOnError";
|
||||
export * from "../unittests/tsbuild/outFile";
|
||||
export * from "../unittests/tsbuild/outputPaths";
|
||||
export * from "../unittests/tsbuild/publicApi";
|
||||
export * from "../unittests/tsbuild/referencesWithRootDirInParent";
|
||||
export * from "../unittests/tsbuild/resolveJsonModule";
|
||||
export * from "../unittests/tsbuild/sample";
|
||||
export * from "../unittests/tsbuild/transitiveReferences";
|
||||
export * from "../unittests/tsc/composite";
|
||||
export * from "../unittests/tsc/declarationEmit";
|
||||
export * from "../unittests/tsc/forceConsistentCasingInFileNames";
|
||||
export * from "../unittests/tsc/incremental";
|
||||
export * from "../unittests/tsc/listFilesOnly";
|
||||
export * from "../unittests/tsc/projectReferences";
|
||||
export * from "../unittests/tsc/redirect";
|
||||
export * from "../unittests/tsc/runWithoutArgs";
|
||||
export * from "../unittests/tsserver/versionCache";
|
||||
export * from "../unittests/debugDeprecation";
|
||||
import * as tscWatch from "./ts.tscWatch";
|
||||
export { tscWatch };
|
||||
import * as projectSystem from "./ts.projectSystem";
|
||||
export { projectSystem };
|
||||
import * as server from "./ts.server";
|
||||
export { server };
|
||||
import * as textStorage from "./ts.textStorage";
|
||||
export { textStorage };
|
||||
|
||||
@@ -1,28 +1,3 @@
|
||||
/* Generated file to emulate the ts.tscWatch namespace. */
|
||||
|
||||
export * from "../unittests/tscWatch/helpers";
|
||||
export * from "../unittests/tsbuild/moduleResolution";
|
||||
export * from "../unittests/tsbuildWatch/configFileErrors";
|
||||
export * from "../unittests/tsbuildWatch/demo";
|
||||
export * from "../unittests/tsbuildWatch/moduleResolution";
|
||||
export * from "../unittests/tsbuildWatch/noEmit";
|
||||
export * from "../unittests/tsbuildWatch/noEmitOnError";
|
||||
export * from "../unittests/tsbuildWatch/programUpdates";
|
||||
export * from "../unittests/tsbuildWatch/projectsBuilding";
|
||||
export * from "../unittests/tsbuildWatch/publicApi";
|
||||
export * from "../unittests/tsbuildWatch/reexport";
|
||||
export * from "../unittests/tsbuildWatch/watchEnvironment";
|
||||
export * from "../unittests/tsc/cancellationToken";
|
||||
export * from "../unittests/tscWatch/consoleClearing";
|
||||
export * from "../unittests/tscWatch/emit";
|
||||
export * from "../unittests/tscWatch/nodeNextWatch";
|
||||
export * from "../unittests/tscWatch/emitAndErrorUpdates";
|
||||
export * from "../unittests/tscWatch/forceConsistentCasingInFileNames";
|
||||
export * from "../unittests/tscWatch/incremental";
|
||||
export * from "../unittests/tscWatch/moduleResolution";
|
||||
export * from "../unittests/tscWatch/programUpdates";
|
||||
export * from "../unittests/tscWatch/projectsWithReferences";
|
||||
export * from "../unittests/tscWatch/resolutionCache";
|
||||
export * from "../unittests/tscWatch/sourceOfProjectReferenceRedirect";
|
||||
export * from "../unittests/tscWatch/watchApi";
|
||||
export * from "../unittests/tscWatch/watchEnvironment";
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* Generated file to emulate the vfs namespace. */
|
||||
|
||||
export * from "../../harness/_namespaces/vfs";
|
||||
export * from "../vfsRef";
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* Generated file to emulate the vpath namespace. */
|
||||
|
||||
export * from "../../harness/_namespaces/vpath";
|
||||
export * from "../vpathRef";
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
// empty ref to compiler so it can be referenced by unittests
|
||||
export { };
|
||||
@@ -1,2 +0,0 @@
|
||||
// empty ref to documents so it can be referenced by unittests
|
||||
export { };
|
||||
@@ -1,2 +0,0 @@
|
||||
// empty ref to evaluator so it can be referenced by unittests
|
||||
export { };
|
||||
@@ -1,2 +0,0 @@
|
||||
// empty ref to fakes so it can be referenced by unittests
|
||||
export { };
|
||||
@@ -1,2 +0,0 @@
|
||||
// empty ref to FourSlash so it can be referenced by unittests
|
||||
export { };
|
||||
@@ -263,7 +263,7 @@ export function start() {
|
||||
const configPath = ts.combinePaths(taskConfigsFolder, `task-config${i}.json`);
|
||||
IO.writeFile(configPath, JSON.stringify(config));
|
||||
const worker: Worker = {
|
||||
process: fork(__filename, [`--config="${configPath}"`], { stdio: ["pipe", "pipe", "pipe", "ipc"] }),
|
||||
process: fork(process.argv[1], [`--config="${configPath}"`], { stdio: ["pipe", "pipe", "pipe", "ipc"] }),
|
||||
accumulatedOutput: "",
|
||||
currentTasks: undefined,
|
||||
timer: undefined
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
// empty ref to Playback so it can be referenced by unittests
|
||||
export { };
|
||||
@@ -291,3 +291,11 @@ function startTestEnvironment() {
|
||||
}
|
||||
|
||||
startTestEnvironment();
|
||||
|
||||
// This brings in all of the unittests.
|
||||
|
||||
// If running as emitted CJS, we want to start the tests here after startTestEnvironment.
|
||||
// If running bundled, we will do this in Harness.ts.
|
||||
if (__filename.endsWith("runner.js")) {
|
||||
require("./tests");
|
||||
}
|
||||
|
||||
189
src/testRunner/tests.ts
Normal file
189
src/testRunner/tests.ts
Normal file
@@ -0,0 +1,189 @@
|
||||
import "./unittests/asserts";
|
||||
import "./unittests/base64";
|
||||
import "./unittests/builder";
|
||||
import "./unittests/comments";
|
||||
import "./unittests/compilerCore";
|
||||
import "./unittests/convertToBase64";
|
||||
import "./unittests/customTransforms";
|
||||
import "./unittests/factory";
|
||||
import "./unittests/incrementalParser";
|
||||
import "./unittests/jsDocParsing";
|
||||
import "./unittests/jsonParserRecovery";
|
||||
import "./unittests/moduleResolution";
|
||||
import "./unittests/parsePseudoBigInt";
|
||||
import "./unittests/paths";
|
||||
import "./unittests/printer";
|
||||
import "./unittests/programApi";
|
||||
import "./unittests/publicApi";
|
||||
import "./unittests/reuseProgramStructure";
|
||||
import "./unittests/semver";
|
||||
import "./unittests/transform";
|
||||
import "./unittests/typeParameterIsPossiblyReferenced";
|
||||
import "./unittests/config/commandLineParsing";
|
||||
import "./unittests/config/configurationExtension";
|
||||
import "./unittests/config/convertCompilerOptionsFromJson";
|
||||
import "./unittests/config/convertTypeAcquisitionFromJson";
|
||||
import "./unittests/config/initializeTSConfig";
|
||||
import "./unittests/config/matchFiles";
|
||||
import "./unittests/config/projectReferences";
|
||||
import "./unittests/config/showConfig";
|
||||
import "./unittests/config/tsconfigParsing";
|
||||
import "./unittests/config/tsconfigParsingWatchOptions";
|
||||
import "./unittests/evaluation/arraySpread";
|
||||
import "./unittests/evaluation/asyncArrow";
|
||||
import "./unittests/evaluation/asyncGenerator";
|
||||
import "./unittests/evaluation/autoAccessors";
|
||||
import "./unittests/evaluation/awaiter";
|
||||
import "./unittests/evaluation/destructuring";
|
||||
import "./unittests/evaluation/externalModules";
|
||||
import "./unittests/evaluation/forAwaitOf";
|
||||
import "./unittests/evaluation/forOf";
|
||||
import "./unittests/evaluation/generator";
|
||||
import "./unittests/evaluation/optionalCall";
|
||||
import "./unittests/evaluation/objectRest";
|
||||
import "./unittests/evaluation/superInStaticInitializer";
|
||||
import "./unittests/evaluation/templateLiteral";
|
||||
import "./unittests/evaluation/updateExpressionInModule";
|
||||
import "./unittests/services/cancellableLanguageServiceOperations";
|
||||
import "./unittests/services/colorization";
|
||||
import "./unittests/services/convertToAsyncFunction";
|
||||
import "./unittests/services/documentRegistry";
|
||||
import "./unittests/services/extract/constants";
|
||||
import "./unittests/services/extract/functions";
|
||||
import "./unittests/services/extract/symbolWalker";
|
||||
import "./unittests/services/extract/ranges";
|
||||
import "./unittests/services/hostNewLineSupport";
|
||||
import "./unittests/services/languageService";
|
||||
import "./unittests/services/organizeImports";
|
||||
import "./unittests/services/patternMatcher";
|
||||
import "./unittests/services/preProcessFile";
|
||||
import "./unittests/services/textChanges";
|
||||
import "./unittests/services/transpile";
|
||||
import "./unittests/tsbuild/amdModulesWithOut";
|
||||
import "./unittests/tsbuild/clean";
|
||||
import "./unittests/tsbuild/commandLine";
|
||||
import "./unittests/tsbuild/configFileErrors";
|
||||
import "./unittests/tsbuild/configFileExtends";
|
||||
import "./unittests/tsbuild/containerOnlyReferenced";
|
||||
import "./unittests/tsbuild/declarationEmit";
|
||||
import "./unittests/tsbuild/demo";
|
||||
import "./unittests/tsbuild/emitDeclarationOnly";
|
||||
import "./unittests/tsbuild/emptyFiles";
|
||||
import "./unittests/tsbuild/exitCodeOnBogusFile";
|
||||
import "./unittests/tsbuild/graphOrdering";
|
||||
import "./unittests/tsbuild/inferredTypeFromTransitiveModule";
|
||||
import "./unittests/tsbuild/javascriptProjectEmit";
|
||||
import "./unittests/tsbuild/lateBoundSymbol";
|
||||
import "./unittests/tsbuild/moduleResolution";
|
||||
import "./unittests/tsbuild/moduleSpecifiers";
|
||||
import "./unittests/tsbuild/noEmit";
|
||||
import "./unittests/tsbuild/noEmitOnError";
|
||||
import "./unittests/tsbuild/outFile";
|
||||
import "./unittests/tsbuild/outputPaths";
|
||||
import "./unittests/tsbuild/publicApi";
|
||||
import "./unittests/tsbuild/referencesWithRootDirInParent";
|
||||
import "./unittests/tsbuild/resolveJsonModule";
|
||||
import "./unittests/tsbuild/sample";
|
||||
import "./unittests/tsbuild/transitiveReferences";
|
||||
import "./unittests/tsbuildWatch/configFileErrors";
|
||||
import "./unittests/tsbuildWatch/demo";
|
||||
import "./unittests/tsbuildWatch/moduleResolution";
|
||||
import "./unittests/tsbuildWatch/noEmit";
|
||||
import "./unittests/tsbuildWatch/noEmitOnError";
|
||||
import "./unittests/tsbuildWatch/programUpdates";
|
||||
import "./unittests/tsbuildWatch/projectsBuilding";
|
||||
import "./unittests/tsbuildWatch/publicApi";
|
||||
import "./unittests/tsbuildWatch/reexport";
|
||||
import "./unittests/tsbuildWatch/watchEnvironment";
|
||||
import "./unittests/tsc/cancellationToken";
|
||||
import "./unittests/tsc/composite";
|
||||
import "./unittests/tsc/declarationEmit";
|
||||
import "./unittests/tsc/forceConsistentCasingInFileNames";
|
||||
import "./unittests/tsc/incremental";
|
||||
import "./unittests/tsc/listFilesOnly";
|
||||
import "./unittests/tsc/projectReferences";
|
||||
import "./unittests/tsc/redirect";
|
||||
import "./unittests/tsc/runWithoutArgs";
|
||||
import "./unittests/tscWatch/consoleClearing";
|
||||
import "./unittests/tscWatch/emit";
|
||||
import "./unittests/tscWatch/nodeNextWatch";
|
||||
import "./unittests/tscWatch/emitAndErrorUpdates";
|
||||
import "./unittests/tscWatch/forceConsistentCasingInFileNames";
|
||||
import "./unittests/tscWatch/incremental";
|
||||
import "./unittests/tscWatch/moduleResolution";
|
||||
import "./unittests/tscWatch/programUpdates";
|
||||
import "./unittests/tscWatch/projectsWithReferences";
|
||||
import "./unittests/tscWatch/resolutionCache";
|
||||
import "./unittests/tscWatch/sourceOfProjectReferenceRedirect";
|
||||
import "./unittests/tscWatch/watchApi";
|
||||
import "./unittests/tscWatch/watchEnvironment";
|
||||
import "./unittests/tsserver/applyChangesToOpenFiles";
|
||||
import "./unittests/tsserver/autoImportProvider";
|
||||
import "./unittests/tsserver/auxiliaryProject";
|
||||
import "./unittests/tsserver/cachingFileSystemInformation";
|
||||
import "./unittests/tsserver/cancellationToken";
|
||||
import "./unittests/tsserver/compileOnSave";
|
||||
import "./unittests/tsserver/completions";
|
||||
import "./unittests/tsserver/completionsIncomplete";
|
||||
import "./unittests/tsserver/configFileSearch";
|
||||
import "./unittests/tsserver/configuredProjects";
|
||||
import "./unittests/tsserver/declarationFileMaps";
|
||||
import "./unittests/tsserver/documentRegistry";
|
||||
import "./unittests/tsserver/duplicatePackages";
|
||||
import "./unittests/tsserver/dynamicFiles";
|
||||
import "./unittests/tsserver/events/largeFileReferenced";
|
||||
import "./unittests/tsserver/events/projectLanguageServiceState";
|
||||
import "./unittests/tsserver/events/projectLoading";
|
||||
import "./unittests/tsserver/events/projectUpdatedInBackground";
|
||||
import "./unittests/tsserver/exportMapCache";
|
||||
import "./unittests/tsserver/externalProjects";
|
||||
import "./unittests/tsserver/forceConsistentCasingInFileNames";
|
||||
import "./unittests/tsserver/formatSettings";
|
||||
import "./unittests/tsserver/getApplicableRefactors";
|
||||
import "./unittests/tsserver/getEditsForFileRename";
|
||||
import "./unittests/tsserver/getExportReferences";
|
||||
import "./unittests/tsserver/getFileReferences";
|
||||
import "./unittests/tsserver/importHelpers";
|
||||
import "./unittests/tsserver/inlayHints";
|
||||
import "./unittests/tsserver/inferredProjects";
|
||||
import "./unittests/tsserver/jsdocTag";
|
||||
import "./unittests/tsserver/languageService";
|
||||
import "./unittests/tsserver/maxNodeModuleJsDepth";
|
||||
import "./unittests/tsserver/metadataInResponse";
|
||||
import "./unittests/tsserver/moduleResolution";
|
||||
import "./unittests/tsserver/moduleSpecifierCache";
|
||||
import "./unittests/tsserver/navTo";
|
||||
import "./unittests/tsserver/occurences";
|
||||
import "./unittests/tsserver/openFile";
|
||||
import "./unittests/tsserver/packageJsonInfo";
|
||||
import "./unittests/tsserver/partialSemanticServer";
|
||||
import "./unittests/tsserver/plugins";
|
||||
import "./unittests/tsserver/projectErrors";
|
||||
import "./unittests/tsserver/projectReferenceCompileOnSave";
|
||||
import "./unittests/tsserver/projectReferenceErrors";
|
||||
import "./unittests/tsserver/projectReferences";
|
||||
import "./unittests/tsserver/projectReferencesSourcemap";
|
||||
import "./unittests/tsserver/projects";
|
||||
import "./unittests/tsserver/projectsWithReferences";
|
||||
import "./unittests/tsserver/refactors";
|
||||
import "./unittests/tsserver/reload";
|
||||
import "./unittests/tsserver/reloadProjects";
|
||||
import "./unittests/tsserver/rename";
|
||||
import "./unittests/tsserver/resolutionCache";
|
||||
import "./unittests/tsserver/session";
|
||||
import "./unittests/tsserver/skipLibCheck";
|
||||
import "./unittests/tsserver/smartSelection";
|
||||
import "./unittests/tsserver/symlinkCache";
|
||||
import "./unittests/tsserver/symLinks";
|
||||
import "./unittests/tsserver/syntacticServer";
|
||||
import "./unittests/tsserver/syntaxOperations";
|
||||
import "./unittests/tsserver/textStorage";
|
||||
import "./unittests/tsserver/telemetry";
|
||||
import "./unittests/tsserver/typeAquisition";
|
||||
import "./unittests/tsserver/typeOnlyImportChains";
|
||||
import "./unittests/tsserver/typeReferenceDirectives";
|
||||
import "./unittests/tsserver/typingsInstaller";
|
||||
import "./unittests/tsserver/versionCache";
|
||||
import "./unittests/tsserver/watchEnvironment";
|
||||
import "./unittests/tsserver/webServer";
|
||||
import "./unittests/debugDeprecation";
|
||||
@@ -1,10 +1,7 @@
|
||||
{
|
||||
"extends": "../tsconfig-noncomposite-base",
|
||||
"extends": "../tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../built/local",
|
||||
"composite": false,
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
"outDir": "../../built/local/testRunner",
|
||||
"types": [
|
||||
"node", "mocha", "chai"
|
||||
],
|
||||
@@ -25,245 +22,5 @@
|
||||
{ "path": "../harness" },
|
||||
{ "path": "../loggedIO" }
|
||||
],
|
||||
|
||||
"files": [
|
||||
"compilerRef.ts",
|
||||
"evaluatorRef.ts",
|
||||
"fakesRef.ts",
|
||||
"vpathRef.ts",
|
||||
"vfsRef.ts",
|
||||
"fourslashRef.ts",
|
||||
"playbackRef.ts",
|
||||
"utilsRef.ts",
|
||||
"documentsRef.ts",
|
||||
|
||||
"fourslashRunner.ts",
|
||||
"compilerRunner.ts",
|
||||
"projectsRunner.ts",
|
||||
"rwcRunner.ts",
|
||||
"externalCompileRunner.ts",
|
||||
"test262Runner.ts",
|
||||
|
||||
"parallel/host.ts",
|
||||
"parallel/worker.ts",
|
||||
"parallel/shared.ts",
|
||||
|
||||
"runner.ts",
|
||||
|
||||
"unittests/services/extract/helpers.ts",
|
||||
"unittests/tsbuild/helpers.ts",
|
||||
"unittests/tsc/helpers.ts",
|
||||
"unittests/tscWatch/helpers.ts",
|
||||
"unittests/tsserver/helpers.ts",
|
||||
|
||||
"unittests/asserts.ts",
|
||||
"unittests/base64.ts",
|
||||
"unittests/builder.ts",
|
||||
"unittests/comments.ts",
|
||||
"unittests/compilerCore.ts",
|
||||
"unittests/convertToBase64.ts",
|
||||
"unittests/customTransforms.ts",
|
||||
"unittests/factory.ts",
|
||||
"unittests/incrementalParser.ts",
|
||||
"unittests/jsDocParsing.ts",
|
||||
"unittests/jsonParserRecovery.ts",
|
||||
"unittests/moduleResolution.ts",
|
||||
"unittests/parsePseudoBigInt.ts",
|
||||
"unittests/paths.ts",
|
||||
"unittests/printer.ts",
|
||||
"unittests/programApi.ts",
|
||||
"unittests/publicApi.ts",
|
||||
"unittests/reuseProgramStructure.ts",
|
||||
"unittests/semver.ts",
|
||||
"unittests/transform.ts",
|
||||
"unittests/typeParameterIsPossiblyReferenced.ts",
|
||||
"unittests/config/commandLineParsing.ts",
|
||||
"unittests/config/configurationExtension.ts",
|
||||
"unittests/config/convertCompilerOptionsFromJson.ts",
|
||||
"unittests/config/convertTypeAcquisitionFromJson.ts",
|
||||
"unittests/config/initializeTSConfig.ts",
|
||||
"unittests/config/matchFiles.ts",
|
||||
"unittests/config/projectReferences.ts",
|
||||
"unittests/config/showConfig.ts",
|
||||
"unittests/config/tsconfigParsing.ts",
|
||||
"unittests/config/tsconfigParsingWatchOptions.ts",
|
||||
"unittests/evaluation/arraySpread.ts",
|
||||
"unittests/evaluation/asyncArrow.ts",
|
||||
"unittests/evaluation/asyncGenerator.ts",
|
||||
"unittests/evaluation/autoAccessors.ts",
|
||||
"unittests/evaluation/awaiter.ts",
|
||||
"unittests/evaluation/destructuring.ts",
|
||||
"unittests/evaluation/externalModules.ts",
|
||||
"unittests/evaluation/forAwaitOf.ts",
|
||||
"unittests/evaluation/forOf.ts",
|
||||
"unittests/evaluation/generator.ts",
|
||||
"unittests/evaluation/optionalCall.ts",
|
||||
"unittests/evaluation/objectRest.ts",
|
||||
"unittests/evaluation/superInStaticInitializer.ts",
|
||||
"unittests/evaluation/templateLiteral.ts",
|
||||
"unittests/evaluation/updateExpressionInModule.ts",
|
||||
"unittests/services/cancellableLanguageServiceOperations.ts",
|
||||
"unittests/services/colorization.ts",
|
||||
"unittests/services/convertToAsyncFunction.ts",
|
||||
"unittests/services/documentRegistry.ts",
|
||||
"unittests/services/extract/constants.ts",
|
||||
"unittests/services/extract/functions.ts",
|
||||
"unittests/services/extract/symbolWalker.ts",
|
||||
"unittests/services/extract/ranges.ts",
|
||||
"unittests/services/hostNewLineSupport.ts",
|
||||
"unittests/services/languageService.ts",
|
||||
"unittests/services/organizeImports.ts",
|
||||
"unittests/services/patternMatcher.ts",
|
||||
"unittests/services/preProcessFile.ts",
|
||||
"unittests/services/textChanges.ts",
|
||||
"unittests/services/transpile.ts",
|
||||
"unittests/tsbuild/amdModulesWithOut.ts",
|
||||
"unittests/tsbuild/clean.ts",
|
||||
"unittests/tsbuild/commandLine.ts",
|
||||
"unittests/tsbuild/configFileErrors.ts",
|
||||
"unittests/tsbuild/configFileExtends.ts",
|
||||
"unittests/tsbuild/containerOnlyReferenced.ts",
|
||||
"unittests/tsbuild/declarationEmit.ts",
|
||||
"unittests/tsbuild/demo.ts",
|
||||
"unittests/tsbuild/emitDeclarationOnly.ts",
|
||||
"unittests/tsbuild/emptyFiles.ts",
|
||||
"unittests/tsbuild/exitCodeOnBogusFile.ts",
|
||||
"unittests/tsbuild/graphOrdering.ts",
|
||||
"unittests/tsbuild/inferredTypeFromTransitiveModule.ts",
|
||||
"unittests/tsbuild/javascriptProjectEmit.ts",
|
||||
"unittests/tsbuild/lateBoundSymbol.ts",
|
||||
"unittests/tsbuild/moduleResolution.ts",
|
||||
"unittests/tsbuild/moduleSpecifiers.ts",
|
||||
"unittests/tsbuild/noEmit.ts",
|
||||
"unittests/tsbuild/noEmitOnError.ts",
|
||||
"unittests/tsbuild/outFile.ts",
|
||||
"unittests/tsbuild/outputPaths.ts",
|
||||
"unittests/tsbuild/publicApi.ts",
|
||||
"unittests/tsbuild/referencesWithRootDirInParent.ts",
|
||||
"unittests/tsbuild/resolveJsonModule.ts",
|
||||
"unittests/tsbuild/sample.ts",
|
||||
"unittests/tsbuild/transitiveReferences.ts",
|
||||
"unittests/tsbuildWatch/configFileErrors.ts",
|
||||
"unittests/tsbuildWatch/demo.ts",
|
||||
"unittests/tsbuildWatch/moduleResolution.ts",
|
||||
"unittests/tsbuildWatch/noEmit.ts",
|
||||
"unittests/tsbuildWatch/noEmitOnError.ts",
|
||||
"unittests/tsbuildWatch/programUpdates.ts",
|
||||
"unittests/tsbuildWatch/projectsBuilding.ts",
|
||||
"unittests/tsbuildWatch/publicApi.ts",
|
||||
"unittests/tsbuildWatch/reexport.ts",
|
||||
"unittests/tsbuildWatch/watchEnvironment.ts",
|
||||
"unittests/tsc/cancellationToken.ts",
|
||||
"unittests/tsc/composite.ts",
|
||||
"unittests/tsc/declarationEmit.ts",
|
||||
"unittests/tsc/forceConsistentCasingInFileNames.ts",
|
||||
"unittests/tsc/incremental.ts",
|
||||
"unittests/tsc/listFilesOnly.ts",
|
||||
"unittests/tsc/projectReferences.ts",
|
||||
"unittests/tsc/redirect.ts",
|
||||
"unittests/tsc/runWithoutArgs.ts",
|
||||
"unittests/tscWatch/consoleClearing.ts",
|
||||
"unittests/tscWatch/emit.ts",
|
||||
"unittests/tscWatch/nodeNextWatch.ts",
|
||||
"unittests/tscWatch/emitAndErrorUpdates.ts",
|
||||
"unittests/tscWatch/forceConsistentCasingInFileNames.ts",
|
||||
"unittests/tscWatch/incremental.ts",
|
||||
"unittests/tscWatch/moduleResolution.ts",
|
||||
"unittests/tscWatch/programUpdates.ts",
|
||||
"unittests/tscWatch/projectsWithReferences.ts",
|
||||
"unittests/tscWatch/resolutionCache.ts",
|
||||
"unittests/tscWatch/sourceOfProjectReferenceRedirect.ts",
|
||||
"unittests/tscWatch/watchApi.ts",
|
||||
"unittests/tscWatch/watchEnvironment.ts",
|
||||
"unittests/tsserver/applyChangesToOpenFiles.ts",
|
||||
"unittests/tsserver/autoImportProvider.ts",
|
||||
"unittests/tsserver/auxiliaryProject.ts",
|
||||
"unittests/tsserver/cachingFileSystemInformation.ts",
|
||||
"unittests/tsserver/cancellationToken.ts",
|
||||
"unittests/tsserver/compileOnSave.ts",
|
||||
"unittests/tsserver/completions.ts",
|
||||
"unittests/tsserver/completionsIncomplete.ts",
|
||||
"unittests/tsserver/configFileSearch.ts",
|
||||
"unittests/tsserver/configuredProjects.ts",
|
||||
"unittests/tsserver/declarationFileMaps.ts",
|
||||
"unittests/tsserver/documentRegistry.ts",
|
||||
"unittests/tsserver/duplicatePackages.ts",
|
||||
"unittests/tsserver/dynamicFiles.ts",
|
||||
"unittests/tsserver/events/largeFileReferenced.ts",
|
||||
"unittests/tsserver/events/projectLanguageServiceState.ts",
|
||||
"unittests/tsserver/events/projectLoading.ts",
|
||||
"unittests/tsserver/events/projectUpdatedInBackground.ts",
|
||||
"unittests/tsserver/exportMapCache.ts",
|
||||
"unittests/tsserver/externalProjects.ts",
|
||||
"unittests/tsserver/forceConsistentCasingInFileNames.ts",
|
||||
"unittests/tsserver/formatSettings.ts",
|
||||
"unittests/tsserver/getApplicableRefactors.ts",
|
||||
"unittests/tsserver/getEditsForFileRename.ts",
|
||||
"unittests/tsserver/getExportReferences.ts",
|
||||
"unittests/tsserver/getFileReferences.ts",
|
||||
"unittests/tsserver/importHelpers.ts",
|
||||
"unittests/tsserver/inlayHints.ts",
|
||||
"unittests/tsserver/inferredProjects.ts",
|
||||
"unittests/tsserver/jsdocTag.ts",
|
||||
"unittests/tsserver/languageService.ts",
|
||||
"unittests/tsserver/maxNodeModuleJsDepth.ts",
|
||||
"unittests/tsserver/metadataInResponse.ts",
|
||||
"unittests/tsserver/moduleResolution.ts",
|
||||
"unittests/tsserver/moduleSpecifierCache.ts",
|
||||
"unittests/tsserver/navTo.ts",
|
||||
"unittests/tsserver/occurences.ts",
|
||||
"unittests/tsserver/openFile.ts",
|
||||
"unittests/tsserver/packageJsonInfo.ts",
|
||||
"unittests/tsserver/partialSemanticServer.ts",
|
||||
"unittests/tsserver/plugins.ts",
|
||||
"unittests/tsserver/projectErrors.ts",
|
||||
"unittests/tsserver/projectReferenceCompileOnSave.ts",
|
||||
"unittests/tsserver/projectReferenceErrors.ts",
|
||||
"unittests/tsserver/projectReferences.ts",
|
||||
"unittests/tsserver/projectReferencesSourcemap.ts",
|
||||
"unittests/tsserver/projects.ts",
|
||||
"unittests/tsserver/projectsWithReferences.ts",
|
||||
"unittests/tsserver/refactors.ts",
|
||||
"unittests/tsserver/reload.ts",
|
||||
"unittests/tsserver/reloadProjects.ts",
|
||||
"unittests/tsserver/rename.ts",
|
||||
"unittests/tsserver/resolutionCache.ts",
|
||||
"unittests/tsserver/session.ts",
|
||||
"unittests/tsserver/skipLibCheck.ts",
|
||||
"unittests/tsserver/smartSelection.ts",
|
||||
"unittests/tsserver/symlinkCache.ts",
|
||||
"unittests/tsserver/symLinks.ts",
|
||||
"unittests/tsserver/syntacticServer.ts",
|
||||
"unittests/tsserver/syntaxOperations.ts",
|
||||
"unittests/tsserver/textStorage.ts",
|
||||
"unittests/tsserver/telemetry.ts",
|
||||
"unittests/tsserver/typeAquisition.ts",
|
||||
"unittests/tsserver/typeOnlyImportChains.ts",
|
||||
"unittests/tsserver/typeReferenceDirectives.ts",
|
||||
"unittests/tsserver/typingsInstaller.ts",
|
||||
"unittests/tsserver/versionCache.ts",
|
||||
"unittests/tsserver/watchEnvironment.ts",
|
||||
"unittests/tsserver/webServer.ts",
|
||||
"unittests/debugDeprecation.ts",
|
||||
"_namespaces/compiler.ts",
|
||||
"_namespaces/Harness.ts",
|
||||
"_namespaces/documents.ts",
|
||||
"_namespaces/evaluator.ts",
|
||||
"_namespaces/fakes.ts",
|
||||
"_namespaces/FourSlash.ts",
|
||||
"_namespaces/Playback.ts",
|
||||
"_namespaces/project.ts",
|
||||
"_namespaces/RWC.ts",
|
||||
"_namespaces/Utils.ts",
|
||||
"_namespaces/vfs.ts",
|
||||
"_namespaces/vpath.ts",
|
||||
"_namespaces/Harness.Parallel.Host.ts",
|
||||
"_namespaces/Harness.Parallel.ts",
|
||||
"_namespaces/Harness.Parallel.Worker.ts",
|
||||
"_namespaces/ts.ts",
|
||||
"_namespaces/ts.tscWatch.ts",
|
||||
"_namespaces/ts.projectSystem.ts",
|
||||
"_namespaces/ts.server.ts",
|
||||
"_namespaces/ts.textStorage.ts"
|
||||
]
|
||||
"include": ["**/*"]
|
||||
}
|
||||
|
||||
241
src/testRunner/unittests/helpers.ts
Normal file
241
src/testRunner/unittests/helpers.ts
Normal file
@@ -0,0 +1,241 @@
|
||||
import * as ts from "../_namespaces/ts";
|
||||
|
||||
const enum ChangedPart {
|
||||
references = 1 << 0,
|
||||
importsAndExports = 1 << 1,
|
||||
program = 1 << 2
|
||||
}
|
||||
|
||||
export const newLine = "\r\n";
|
||||
|
||||
export interface SourceFileWithText extends ts.SourceFile {
|
||||
sourceText?: SourceText;
|
||||
}
|
||||
|
||||
export interface NamedSourceText {
|
||||
name: string;
|
||||
text: SourceText;
|
||||
}
|
||||
|
||||
export interface ProgramWithSourceTexts extends ts.Program {
|
||||
sourceTexts?: readonly NamedSourceText[];
|
||||
host: TestCompilerHost;
|
||||
}
|
||||
|
||||
export interface TestCompilerHost extends ts.CompilerHost {
|
||||
getTrace(): string[];
|
||||
}
|
||||
|
||||
export class SourceText implements ts.IScriptSnapshot {
|
||||
private fullText: string | undefined;
|
||||
|
||||
constructor(private references: string,
|
||||
private importsAndExports: string,
|
||||
private program: string,
|
||||
private changedPart: ChangedPart = 0,
|
||||
private version = 0) {
|
||||
}
|
||||
|
||||
static New(references: string, importsAndExports: string, program: string): SourceText {
|
||||
ts.Debug.assert(references !== undefined);
|
||||
ts.Debug.assert(importsAndExports !== undefined);
|
||||
ts.Debug.assert(program !== undefined);
|
||||
return new SourceText(references + newLine, importsAndExports + newLine, program || "");
|
||||
}
|
||||
|
||||
public getVersion(): number {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
public updateReferences(newReferences: string): SourceText {
|
||||
ts.Debug.assert(newReferences !== undefined);
|
||||
return new SourceText(newReferences + newLine, this.importsAndExports, this.program, this.changedPart | ChangedPart.references, this.version + 1);
|
||||
}
|
||||
public updateImportsAndExports(newImportsAndExports: string): SourceText {
|
||||
ts.Debug.assert(newImportsAndExports !== undefined);
|
||||
return new SourceText(this.references, newImportsAndExports + newLine, this.program, this.changedPart | ChangedPart.importsAndExports, this.version + 1);
|
||||
}
|
||||
public updateProgram(newProgram: string): SourceText {
|
||||
ts.Debug.assert(newProgram !== undefined);
|
||||
return new SourceText(this.references, this.importsAndExports, newProgram, this.changedPart | ChangedPart.program, this.version + 1);
|
||||
}
|
||||
|
||||
public getFullText() {
|
||||
return this.fullText || (this.fullText = this.references + this.importsAndExports + this.program);
|
||||
}
|
||||
|
||||
public getText(start: number, end: number): string {
|
||||
return this.getFullText().substring(start, end);
|
||||
}
|
||||
|
||||
getLength(): number {
|
||||
return this.getFullText().length;
|
||||
}
|
||||
|
||||
getChangeRange(oldSnapshot: ts.IScriptSnapshot): ts.TextChangeRange {
|
||||
const oldText = oldSnapshot as SourceText;
|
||||
let oldSpan: ts.TextSpan;
|
||||
let newLength: number;
|
||||
switch (oldText.changedPart ^ this.changedPart) {
|
||||
case ChangedPart.references:
|
||||
oldSpan = ts.createTextSpan(0, oldText.references.length);
|
||||
newLength = this.references.length;
|
||||
break;
|
||||
case ChangedPart.importsAndExports:
|
||||
oldSpan = ts.createTextSpan(oldText.references.length, oldText.importsAndExports.length);
|
||||
newLength = this.importsAndExports.length;
|
||||
break;
|
||||
case ChangedPart.program:
|
||||
oldSpan = ts.createTextSpan(oldText.references.length + oldText.importsAndExports.length, oldText.program.length);
|
||||
newLength = this.program.length;
|
||||
break;
|
||||
default:
|
||||
return ts.Debug.fail("Unexpected change");
|
||||
}
|
||||
|
||||
return ts.createTextChangeRange(oldSpan, newLength);
|
||||
}
|
||||
}
|
||||
|
||||
function createSourceFileWithText(fileName: string, sourceText: SourceText, target: ts.ScriptTarget) {
|
||||
const file = ts.createSourceFile(fileName, sourceText.getFullText(), target) as SourceFileWithText;
|
||||
file.sourceText = sourceText;
|
||||
file.version = "" + sourceText.getVersion();
|
||||
return file;
|
||||
}
|
||||
|
||||
export function createTestCompilerHost(texts: readonly NamedSourceText[], target: ts.ScriptTarget, oldProgram?: ProgramWithSourceTexts, useGetSourceFileByPath?: boolean) {
|
||||
const files = ts.arrayToMap(texts, t => t.name, t => {
|
||||
if (oldProgram) {
|
||||
let oldFile = oldProgram.getSourceFile(t.name) as SourceFileWithText;
|
||||
if (oldFile && oldFile.redirectInfo) {
|
||||
oldFile = oldFile.redirectInfo.unredirected;
|
||||
}
|
||||
if (oldFile && oldFile.sourceText!.getVersion() === t.text.getVersion()) {
|
||||
return oldFile;
|
||||
}
|
||||
}
|
||||
return createSourceFileWithText(t.name, t.text, target);
|
||||
});
|
||||
const useCaseSensitiveFileNames = ts.sys && ts.sys.useCaseSensitiveFileNames;
|
||||
const getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
|
||||
const trace: string[] = [];
|
||||
const result: TestCompilerHost = {
|
||||
trace: s => trace.push(s),
|
||||
getTrace: () => trace,
|
||||
getSourceFile: fileName => files.get(fileName),
|
||||
getDefaultLibFileName: () => "lib.d.ts",
|
||||
writeFile: ts.notImplemented,
|
||||
getCurrentDirectory: () => "",
|
||||
getDirectories: () => [],
|
||||
getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: () => useCaseSensitiveFileNames,
|
||||
getNewLine: () => ts.sys ? ts.sys.newLine : newLine,
|
||||
fileExists: fileName => files.has(fileName),
|
||||
readFile: fileName => {
|
||||
const file = files.get(fileName);
|
||||
return file && file.text;
|
||||
},
|
||||
};
|
||||
if (useGetSourceFileByPath) {
|
||||
const filesByPath = ts.mapEntries(files, (fileName, file) => [ts.toPath(fileName, "", getCanonicalFileName), file]);
|
||||
result.getSourceFileByPath = (_fileName, path) => filesByPath.get(path);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export function newProgram(texts: NamedSourceText[], rootNames: string[], options: ts.CompilerOptions, useGetSourceFileByPath?: boolean): ProgramWithSourceTexts {
|
||||
const host = createTestCompilerHost(texts, options.target!, /*oldProgram*/ undefined, useGetSourceFileByPath);
|
||||
const program = ts.createProgram(rootNames, options, host) as ProgramWithSourceTexts;
|
||||
program.sourceTexts = texts;
|
||||
program.host = host;
|
||||
return program;
|
||||
}
|
||||
|
||||
export function updateProgram(oldProgram: ProgramWithSourceTexts, rootNames: readonly string[], options: ts.CompilerOptions, updater: (files: NamedSourceText[]) => void, newTexts?: NamedSourceText[], useGetSourceFileByPath?: boolean) {
|
||||
if (!newTexts) {
|
||||
newTexts = oldProgram.sourceTexts!.slice(0);
|
||||
}
|
||||
updater(newTexts);
|
||||
const host = createTestCompilerHost(newTexts, options.target!, oldProgram, useGetSourceFileByPath);
|
||||
const program = ts.createProgram(rootNames, options, host, oldProgram) as ProgramWithSourceTexts;
|
||||
program.sourceTexts = newTexts;
|
||||
program.host = host;
|
||||
return program;
|
||||
}
|
||||
|
||||
export function updateProgramText(files: readonly NamedSourceText[], fileName: string, newProgramText: string) {
|
||||
const file = ts.find(files, f => f.name === fileName)!;
|
||||
file.text = file.text.updateProgram(newProgramText);
|
||||
}
|
||||
|
||||
export function checkResolvedTypeDirective(actual: ts.ResolvedTypeReferenceDirective, expected: ts.ResolvedTypeReferenceDirective) {
|
||||
assert.equal(actual.resolvedFileName, expected.resolvedFileName, `'resolvedFileName': expected '${actual.resolvedFileName}' to be equal to '${expected.resolvedFileName}'`);
|
||||
assert.equal(actual.primary, expected.primary, `'primary': expected '${actual.primary}' to be equal to '${expected.primary}'`);
|
||||
return true;
|
||||
}
|
||||
|
||||
function checkCache<T>(caption: string, program: ts.Program, fileName: string, expectedContent: ts.ESMap<string, T> | undefined, getCache: (f: ts.SourceFile) => ts.ModeAwareCache<T> | undefined, entryChecker: (expected: T, original: T) => boolean): void {
|
||||
const file = program.getSourceFile(fileName);
|
||||
assert.isTrue(file !== undefined, `cannot find file ${fileName}`);
|
||||
const cache = getCache(file!);
|
||||
if (expectedContent === undefined) {
|
||||
assert.isTrue(cache === undefined, `expected ${caption} to be undefined`);
|
||||
}
|
||||
else {
|
||||
assert.isTrue(cache !== undefined, `expected ${caption} to be set`);
|
||||
assert.isTrue(mapEqualToCache(expectedContent, cache!, entryChecker), `contents of ${caption} did not match the expected contents.`);
|
||||
}
|
||||
}
|
||||
|
||||
/** True if the maps have the same keys and values. */
|
||||
function mapEqualToCache<T>(left: ts.ESMap<string, T>, right: ts.ModeAwareCache<T>, valuesAreEqual?: (left: T, right: T) => boolean): boolean {
|
||||
if (left as any === right) return true; // given the type mismatch (the tests never pass a cache), this'll never be true
|
||||
if (!left || !right) return false;
|
||||
const someInLeftHasNoMatch = ts.forEachEntry(left, (leftValue, leftKey) => {
|
||||
if (!right.has(leftKey, /*mode*/ undefined)) return true;
|
||||
const rightValue = right.get(leftKey, /*mode*/ undefined)!;
|
||||
return !(valuesAreEqual ? valuesAreEqual(leftValue, rightValue) : leftValue === rightValue);
|
||||
});
|
||||
if (someInLeftHasNoMatch) return false;
|
||||
let someInRightHasNoMatch = false;
|
||||
right.forEach((_, rightKey) => someInRightHasNoMatch = someInRightHasNoMatch || !left.has(rightKey));
|
||||
return !someInRightHasNoMatch;
|
||||
}
|
||||
|
||||
export function checkResolvedModulesCache(program: ts.Program, fileName: string, expectedContent: ts.ESMap<string, ts.ResolvedModule | undefined> | undefined): void {
|
||||
checkCache("resolved modules", program, fileName, expectedContent, f => f.resolvedModules, ts.checkResolvedModule);
|
||||
}
|
||||
|
||||
export function checkResolvedTypeDirectivesCache(program: ts.Program, fileName: string, expectedContent: ts.ESMap<string, ts.ResolvedTypeReferenceDirective> | undefined): void {
|
||||
checkCache("resolved type directives", program, fileName, expectedContent, f => f.resolvedTypeReferenceDirectiveNames, checkResolvedTypeDirective);
|
||||
}
|
||||
|
||||
export function createResolvedModule(resolvedFileName: string, isExternalLibraryImport = false): ts.ResolvedModuleFull {
|
||||
return { resolvedFileName, extension: ts.extensionFromPath(resolvedFileName), isExternalLibraryImport };
|
||||
}
|
||||
|
||||
export function checkResolvedModule(actual: ts.ResolvedModuleFull | undefined, expected: ts.ResolvedModuleFull | undefined): boolean {
|
||||
if (!expected) {
|
||||
if (actual) {
|
||||
assert.fail(actual, expected, "expected resolved module to be undefined");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (!actual) {
|
||||
assert.fail(actual, expected, "expected resolved module to be defined");
|
||||
return false;
|
||||
}
|
||||
|
||||
assert.isTrue(actual.resolvedFileName === expected.resolvedFileName, `'resolvedFileName': expected '${actual.resolvedFileName}' to be equal to '${expected.resolvedFileName}'`);
|
||||
assert.isTrue(actual.extension === expected.extension, `'ext': expected '${actual.extension}' to be equal to '${expected.extension}'`);
|
||||
assert.isTrue(actual.isExternalLibraryImport === expected.isExternalLibraryImport, `'isExternalLibraryImport': expected '${actual.isExternalLibraryImport}' to be equal to '${expected.isExternalLibraryImport}'`);
|
||||
return true;
|
||||
}
|
||||
|
||||
export function checkResolvedModuleWithFailedLookupLocations(actual: ts.ResolvedModuleWithFailedLookupLocations, expectedResolvedModule: ts.ResolvedModuleFull, expectedFailedLookupLocations: string[]): void {
|
||||
assert.isTrue(actual.resolvedModule !== undefined, "module should be resolved");
|
||||
checkResolvedModule(actual.resolvedModule, expectedResolvedModule);
|
||||
assert.deepEqual(actual.failedLookupLocations, expectedFailedLookupLocations, `Failed lookup locations should match - expected has ${expectedFailedLookupLocations.length}, actual has ${actual.failedLookupLocations.length}`);
|
||||
}
|
||||
@@ -1,34 +1,6 @@
|
||||
import * as ts from "../_namespaces/ts";
|
||||
import * as Harness from "../_namespaces/Harness";
|
||||
|
||||
export function checkResolvedModule(actual: ts.ResolvedModuleFull | undefined, expected: ts.ResolvedModuleFull | undefined): boolean {
|
||||
if (!expected) {
|
||||
if (actual) {
|
||||
assert.fail(actual, expected, "expected resolved module to be undefined");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (!actual) {
|
||||
assert.fail(actual, expected, "expected resolved module to be defined");
|
||||
return false;
|
||||
}
|
||||
|
||||
assert.isTrue(actual.resolvedFileName === expected.resolvedFileName, `'resolvedFileName': expected '${actual.resolvedFileName}' to be equal to '${expected.resolvedFileName}'`);
|
||||
assert.isTrue(actual.extension === expected.extension, `'ext': expected '${actual.extension}' to be equal to '${expected.extension}'`);
|
||||
assert.isTrue(actual.isExternalLibraryImport === expected.isExternalLibraryImport, `'isExternalLibraryImport': expected '${actual.isExternalLibraryImport}' to be equal to '${expected.isExternalLibraryImport}'`);
|
||||
return true;
|
||||
}
|
||||
|
||||
export function checkResolvedModuleWithFailedLookupLocations(actual: ts.ResolvedModuleWithFailedLookupLocations, expectedResolvedModule: ts.ResolvedModuleFull, expectedFailedLookupLocations: string[]): void {
|
||||
assert.isTrue(actual.resolvedModule !== undefined, "module should be resolved");
|
||||
checkResolvedModule(actual.resolvedModule, expectedResolvedModule);
|
||||
assert.deepEqual(actual.failedLookupLocations, expectedFailedLookupLocations, `Failed lookup locations should match - expected has ${expectedFailedLookupLocations.length}, actual has ${actual.failedLookupLocations.length}`);
|
||||
}
|
||||
|
||||
export function createResolvedModule(resolvedFileName: string, isExternalLibraryImport = false): ts.ResolvedModuleFull {
|
||||
return { resolvedFileName, extension: ts.extensionFromPath(resolvedFileName), isExternalLibraryImport };
|
||||
}
|
||||
import { checkResolvedModule, checkResolvedModuleWithFailedLookupLocations, createResolvedModule } from "./helpers";
|
||||
|
||||
interface File {
|
||||
name: string;
|
||||
|
||||
@@ -1,215 +1,6 @@
|
||||
import * as ts from "../_namespaces/ts";
|
||||
|
||||
const enum ChangedPart {
|
||||
references = 1 << 0,
|
||||
importsAndExports = 1 << 1,
|
||||
program = 1 << 2
|
||||
}
|
||||
|
||||
const newLine = "\r\n";
|
||||
|
||||
interface SourceFileWithText extends ts.SourceFile {
|
||||
sourceText?: SourceText;
|
||||
}
|
||||
|
||||
export interface NamedSourceText {
|
||||
name: string;
|
||||
text: SourceText;
|
||||
}
|
||||
|
||||
export interface ProgramWithSourceTexts extends ts.Program {
|
||||
sourceTexts?: readonly NamedSourceText[];
|
||||
host: TestCompilerHost;
|
||||
}
|
||||
|
||||
interface TestCompilerHost extends ts.CompilerHost {
|
||||
getTrace(): string[];
|
||||
}
|
||||
|
||||
export class SourceText implements ts.IScriptSnapshot {
|
||||
private fullText: string | undefined;
|
||||
|
||||
constructor(private references: string,
|
||||
private importsAndExports: string,
|
||||
private program: string,
|
||||
private changedPart: ChangedPart = 0,
|
||||
private version = 0) {
|
||||
}
|
||||
|
||||
static New(references: string, importsAndExports: string, program: string): SourceText {
|
||||
ts.Debug.assert(references !== undefined);
|
||||
ts.Debug.assert(importsAndExports !== undefined);
|
||||
ts.Debug.assert(program !== undefined);
|
||||
return new SourceText(references + newLine, importsAndExports + newLine, program || "");
|
||||
}
|
||||
|
||||
public getVersion(): number {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
public updateReferences(newReferences: string): SourceText {
|
||||
ts.Debug.assert(newReferences !== undefined);
|
||||
return new SourceText(newReferences + newLine, this.importsAndExports, this.program, this.changedPart | ChangedPart.references, this.version + 1);
|
||||
}
|
||||
public updateImportsAndExports(newImportsAndExports: string): SourceText {
|
||||
ts.Debug.assert(newImportsAndExports !== undefined);
|
||||
return new SourceText(this.references, newImportsAndExports + newLine, this.program, this.changedPart | ChangedPart.importsAndExports, this.version + 1);
|
||||
}
|
||||
public updateProgram(newProgram: string): SourceText {
|
||||
ts.Debug.assert(newProgram !== undefined);
|
||||
return new SourceText(this.references, this.importsAndExports, newProgram, this.changedPart | ChangedPart.program, this.version + 1);
|
||||
}
|
||||
|
||||
public getFullText() {
|
||||
return this.fullText || (this.fullText = this.references + this.importsAndExports + this.program);
|
||||
}
|
||||
|
||||
public getText(start: number, end: number): string {
|
||||
return this.getFullText().substring(start, end);
|
||||
}
|
||||
|
||||
getLength(): number {
|
||||
return this.getFullText().length;
|
||||
}
|
||||
|
||||
getChangeRange(oldSnapshot: ts.IScriptSnapshot): ts.TextChangeRange {
|
||||
const oldText = oldSnapshot as SourceText;
|
||||
let oldSpan: ts.TextSpan;
|
||||
let newLength: number;
|
||||
switch (oldText.changedPart ^ this.changedPart) {
|
||||
case ChangedPart.references:
|
||||
oldSpan = ts.createTextSpan(0, oldText.references.length);
|
||||
newLength = this.references.length;
|
||||
break;
|
||||
case ChangedPart.importsAndExports:
|
||||
oldSpan = ts.createTextSpan(oldText.references.length, oldText.importsAndExports.length);
|
||||
newLength = this.importsAndExports.length;
|
||||
break;
|
||||
case ChangedPart.program:
|
||||
oldSpan = ts.createTextSpan(oldText.references.length + oldText.importsAndExports.length, oldText.program.length);
|
||||
newLength = this.program.length;
|
||||
break;
|
||||
default:
|
||||
return ts.Debug.fail("Unexpected change");
|
||||
}
|
||||
|
||||
return ts.createTextChangeRange(oldSpan, newLength);
|
||||
}
|
||||
}
|
||||
|
||||
function createSourceFileWithText(fileName: string, sourceText: SourceText, target: ts.ScriptTarget) {
|
||||
const file = ts.createSourceFile(fileName, sourceText.getFullText(), target) as SourceFileWithText;
|
||||
file.sourceText = sourceText;
|
||||
file.version = "" + sourceText.getVersion();
|
||||
return file;
|
||||
}
|
||||
|
||||
export function createTestCompilerHost(texts: readonly NamedSourceText[], target: ts.ScriptTarget, oldProgram?: ProgramWithSourceTexts, useGetSourceFileByPath?: boolean) {
|
||||
const files = ts.arrayToMap(texts, t => t.name, t => {
|
||||
if (oldProgram) {
|
||||
let oldFile = oldProgram.getSourceFile(t.name) as SourceFileWithText;
|
||||
if (oldFile && oldFile.redirectInfo) {
|
||||
oldFile = oldFile.redirectInfo.unredirected;
|
||||
}
|
||||
if (oldFile && oldFile.sourceText!.getVersion() === t.text.getVersion()) {
|
||||
return oldFile;
|
||||
}
|
||||
}
|
||||
return createSourceFileWithText(t.name, t.text, target);
|
||||
});
|
||||
const useCaseSensitiveFileNames = ts.sys && ts.sys.useCaseSensitiveFileNames;
|
||||
const getCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
|
||||
const trace: string[] = [];
|
||||
const result: TestCompilerHost = {
|
||||
trace: s => trace.push(s),
|
||||
getTrace: () => trace,
|
||||
getSourceFile: fileName => files.get(fileName),
|
||||
getDefaultLibFileName: () => "lib.d.ts",
|
||||
writeFile: ts.notImplemented,
|
||||
getCurrentDirectory: () => "",
|
||||
getDirectories: () => [],
|
||||
getCanonicalFileName,
|
||||
useCaseSensitiveFileNames: () => useCaseSensitiveFileNames,
|
||||
getNewLine: () => ts.sys ? ts.sys.newLine : newLine,
|
||||
fileExists: fileName => files.has(fileName),
|
||||
readFile: fileName => {
|
||||
const file = files.get(fileName);
|
||||
return file && file.text;
|
||||
},
|
||||
};
|
||||
if (useGetSourceFileByPath) {
|
||||
const filesByPath = ts.mapEntries(files, (fileName, file) => [ts.toPath(fileName, "", getCanonicalFileName), file]);
|
||||
result.getSourceFileByPath = (_fileName, path) => filesByPath.get(path);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export function newProgram(texts: NamedSourceText[], rootNames: string[], options: ts.CompilerOptions, useGetSourceFileByPath?: boolean): ProgramWithSourceTexts {
|
||||
const host = createTestCompilerHost(texts, options.target!, /*oldProgram*/ undefined, useGetSourceFileByPath);
|
||||
const program = ts.createProgram(rootNames, options, host) as ProgramWithSourceTexts;
|
||||
program.sourceTexts = texts;
|
||||
program.host = host;
|
||||
return program;
|
||||
}
|
||||
|
||||
export function updateProgram(oldProgram: ProgramWithSourceTexts, rootNames: readonly string[], options: ts.CompilerOptions, updater: (files: NamedSourceText[]) => void, newTexts?: NamedSourceText[], useGetSourceFileByPath?: boolean) {
|
||||
if (!newTexts) {
|
||||
newTexts = oldProgram.sourceTexts!.slice(0);
|
||||
}
|
||||
updater(newTexts);
|
||||
const host = createTestCompilerHost(newTexts, options.target!, oldProgram, useGetSourceFileByPath);
|
||||
const program = ts.createProgram(rootNames, options, host, oldProgram) as ProgramWithSourceTexts;
|
||||
program.sourceTexts = newTexts;
|
||||
program.host = host;
|
||||
return program;
|
||||
}
|
||||
|
||||
export function updateProgramText(files: readonly NamedSourceText[], fileName: string, newProgramText: string) {
|
||||
const file = ts.find(files, f => f.name === fileName)!;
|
||||
file.text = file.text.updateProgram(newProgramText);
|
||||
}
|
||||
|
||||
function checkResolvedTypeDirective(actual: ts.ResolvedTypeReferenceDirective, expected: ts.ResolvedTypeReferenceDirective) {
|
||||
assert.equal(actual.resolvedFileName, expected.resolvedFileName, `'resolvedFileName': expected '${actual.resolvedFileName}' to be equal to '${expected.resolvedFileName}'`);
|
||||
assert.equal(actual.primary, expected.primary, `'primary': expected '${actual.primary}' to be equal to '${expected.primary}'`);
|
||||
return true;
|
||||
}
|
||||
|
||||
function checkCache<T>(caption: string, program: ts.Program, fileName: string, expectedContent: ts.ESMap<string, T> | undefined, getCache: (f: ts.SourceFile) => ts.ModeAwareCache<T> | undefined, entryChecker: (expected: T, original: T) => boolean): void {
|
||||
const file = program.getSourceFile(fileName);
|
||||
assert.isTrue(file !== undefined, `cannot find file ${fileName}`);
|
||||
const cache = getCache(file!);
|
||||
if (expectedContent === undefined) {
|
||||
assert.isTrue(cache === undefined, `expected ${caption} to be undefined`);
|
||||
}
|
||||
else {
|
||||
assert.isTrue(cache !== undefined, `expected ${caption} to be set`);
|
||||
assert.isTrue(mapEqualToCache(expectedContent, cache!, entryChecker), `contents of ${caption} did not match the expected contents.`);
|
||||
}
|
||||
}
|
||||
|
||||
/** True if the maps have the same keys and values. */
|
||||
function mapEqualToCache<T>(left: ts.ESMap<string, T>, right: ts.ModeAwareCache<T>, valuesAreEqual?: (left: T, right: T) => boolean): boolean {
|
||||
if (left as any === right) return true; // given the type mismatch (the tests never pass a cache), this'll never be true
|
||||
if (!left || !right) return false;
|
||||
const someInLeftHasNoMatch = ts.forEachEntry(left, (leftValue, leftKey) => {
|
||||
if (!right.has(leftKey, /*mode*/ undefined)) return true;
|
||||
const rightValue = right.get(leftKey, /*mode*/ undefined)!;
|
||||
return !(valuesAreEqual ? valuesAreEqual(leftValue, rightValue) : leftValue === rightValue);
|
||||
});
|
||||
if (someInLeftHasNoMatch) return false;
|
||||
let someInRightHasNoMatch = false;
|
||||
right.forEach((_, rightKey) => someInRightHasNoMatch = someInRightHasNoMatch || !left.has(rightKey));
|
||||
return !someInRightHasNoMatch;
|
||||
}
|
||||
|
||||
function checkResolvedModulesCache(program: ts.Program, fileName: string, expectedContent: ts.ESMap<string, ts.ResolvedModule | undefined> | undefined): void {
|
||||
checkCache("resolved modules", program, fileName, expectedContent, f => f.resolvedModules, ts.checkResolvedModule);
|
||||
}
|
||||
|
||||
function checkResolvedTypeDirectivesCache(program: ts.Program, fileName: string, expectedContent: ts.ESMap<string, ts.ResolvedTypeReferenceDirective> | undefined): void {
|
||||
checkCache("resolved type directives", program, fileName, expectedContent, f => f.resolvedTypeReferenceDirectiveNames, checkResolvedTypeDirective);
|
||||
}
|
||||
import { checkResolvedModulesCache, checkResolvedTypeDirectivesCache, createTestCompilerHost, NamedSourceText, newLine, newProgram, ProgramWithSourceTexts, SourceText, TestCompilerHost, updateProgram, updateProgramText } from "./helpers";
|
||||
|
||||
describe("unittests:: Reuse program structure:: General", () => {
|
||||
const target = ts.ScriptTarget.Latest;
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import * as ts from "../../_namespaces/ts";
|
||||
|
||||
export function verifyDynamic(service: ts.server.ProjectService, path: string) {
|
||||
const info = ts.Debug.checkDefined(service.filenameToScriptInfo.get(path), `Expected ${path} in :: ${JSON.stringify(ts.arrayFrom(service.filenameToScriptInfo.entries(), ([key, f]) => ({ key, fileName: f.fileName, path: f.path })))}`);
|
||||
assert.isTrue(info.isDynamic);
|
||||
}
|
||||
import { verifyDynamic } from "./helpers";
|
||||
|
||||
function verifyPathRecognizedAsDynamic(path: string) {
|
||||
const file: ts.projectSystem.File = {
|
||||
|
||||
@@ -942,3 +942,15 @@ export function verifyGetErrScenario(scenario: VerifyGetErrScenario) {
|
||||
verifyErrorsUsingGeterrForProject(scenario);
|
||||
verifyErrorsUsingSyncMethods(scenario);
|
||||
}
|
||||
|
||||
export function verifyDynamic(service: ts.server.ProjectService, path: string) {
|
||||
const info = ts.Debug.checkDefined(service.filenameToScriptInfo.get(path), `Expected ${path} in :: ${JSON.stringify(ts.arrayFrom(service.filenameToScriptInfo.entries(), ([key, f]) => ({ key, fileName: f.fileName, path: f.path })))}`);
|
||||
assert.isTrue(info.isDynamic);
|
||||
}
|
||||
|
||||
export function createHostWithSolutionBuild(files: readonly ts.TestFSWithWatch.FileOrFolderOrSymLink[], rootNames: readonly string[]) {
|
||||
const host = ts.projectSystem.createServerHost(files);
|
||||
// ts build should succeed
|
||||
ts.tscWatch.ensureErrorFreeBuild(host, rootNames);
|
||||
return host;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
import * as ts from "../../_namespaces/ts";
|
||||
|
||||
export function createHostWithSolutionBuild(files: readonly ts.TestFSWithWatch.FileOrFolderOrSymLink[], rootNames: readonly string[]) {
|
||||
const host = ts.projectSystem.createServerHost(files);
|
||||
// ts build should succeed
|
||||
ts.tscWatch.ensureErrorFreeBuild(host, rootNames);
|
||||
return host;
|
||||
}
|
||||
import { createHostWithSolutionBuild } from "./helpers";
|
||||
|
||||
describe("unittests:: tsserver:: with project references and tsbuild", () => {
|
||||
describe("with container project", () => {
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
// empty ref to Utils so it can be referenced by unittests
|
||||
export { };
|
||||
@@ -1,2 +0,0 @@
|
||||
// empty ref to vfs so it can be referenced by unittests
|
||||
export { };
|
||||
@@ -1,2 +0,0 @@
|
||||
// empty ref to vpath so it can be referenced by unittests
|
||||
export { };
|
||||
@@ -2,4 +2,3 @@
|
||||
|
||||
export * from "../../compiler/_namespaces/ts";
|
||||
export * from "../../executeCommandLine/_namespaces/ts";
|
||||
export * from "../tsc";
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
{
|
||||
"extends": "../tsconfig-noncomposite-base",
|
||||
"extends": "../tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../built/local"
|
||||
"outDir": "../../built/local/tsc"
|
||||
},
|
||||
"files": [
|
||||
"tsc.ts",
|
||||
"_namespaces/ts.ts"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "../compiler" },
|
||||
{ "path": "../executeCommandLine" }
|
||||
]
|
||||
],
|
||||
"include": ["**/*"]
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../built/local/release",
|
||||
"stripInternal": true,
|
||||
"preserveConstEnums": false,
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
"sourceMap": false,
|
||||
"composite": false,
|
||||
"incremental": true
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../compiler/tsconfig.release.json" },
|
||||
{ "path": "../executeCommandLine/tsconfig.release.json" }
|
||||
]
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"pretty": true,
|
||||
"lib": ["es2015.iterable", "es2015.generator", "es5"],
|
||||
"target": "es5",
|
||||
"lib": ["es2018"],
|
||||
"target": "es2018",
|
||||
"module": "CommonJS",
|
||||
"moduleResolution": "node",
|
||||
"rootDir": ".",
|
||||
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"declarationMap": false,
|
||||
"composite": false,
|
||||
"incremental": true,
|
||||
"declaration": true,
|
||||
"stripInternal": true
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
"composite": false,
|
||||
"incremental": true
|
||||
}
|
||||
}
|
||||
@@ -2,13 +2,25 @@
|
||||
"files": [],
|
||||
"include": [],
|
||||
"references": [
|
||||
{ "path": "./cancellationToken" },
|
||||
{ "path": "./compiler" },
|
||||
{ "path": "./debug" },
|
||||
{ "path": "./deprecatedCompat" },
|
||||
{ "path": "./dynamicImportCompat" },
|
||||
{ "path": "./executeCommandLine" },
|
||||
{ "path": "./harness" },
|
||||
{ "path": "./jsTyping" },
|
||||
{ "path": "./loggedIO" },
|
||||
{ "path": "./server" },
|
||||
{ "path": "./services" },
|
||||
{ "path": "./testRunner" },
|
||||
{ "path": "./tsc" },
|
||||
{ "path": "./tsserver" },
|
||||
{ "path": "./tsserverlibrary" },
|
||||
{ "path": "./typescript" },
|
||||
{ "path": "./typingsInstaller" },
|
||||
{ "path": "./typingsInstallerCore" },
|
||||
{ "path": "./watchGuard" },
|
||||
{ "path": "./debug" },
|
||||
{ "path": "./cancellationToken" },
|
||||
{ "path": "./dynamicImportCompat" },
|
||||
{ "path": "./testRunner" }
|
||||
{ "path": "./webServer" },
|
||||
]
|
||||
}
|
||||
|
||||
@@ -526,7 +526,8 @@ function startNodeSession(options: StartSessionOptions, logger: Logger, cancella
|
||||
}
|
||||
}
|
||||
|
||||
this.installer = childProcess.fork(combinePaths(__dirname, "typingsInstaller.js"), args, { execArgv });
|
||||
// TODO(jakebailey): fix this for module transform
|
||||
this.installer = childProcess.fork(combinePaths(__dirname, "..", "typingsInstaller", "nodeTypingsInstaller.js"), args, { execArgv });
|
||||
this.installer.on("message", m => this.handleMessage(m));
|
||||
|
||||
// We have to schedule this event to the next tick
|
||||
|
||||
@@ -1,19 +1,12 @@
|
||||
{
|
||||
"extends": "../tsconfig-noncomposite-base",
|
||||
"extends": "../tsconfig-base",
|
||||
|
||||
"compilerOptions": {
|
||||
"outDir": "../../built/local",
|
||||
"outDir": "../../built/local/tsserver",
|
||||
"types": [
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"nodeServer.ts",
|
||||
"webServer.ts",
|
||||
"server.ts",
|
||||
"_namespaces/ts.server.ts",
|
||||
"_namespaces/ts.ts"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "../compiler" },
|
||||
{ "path": "../services" },
|
||||
@@ -21,5 +14,6 @@
|
||||
{ "path": "../server" },
|
||||
{ "path": "../webServer" },
|
||||
{ "path": "../deprecatedCompat" }
|
||||
]
|
||||
],
|
||||
"include": ["**/*"]
|
||||
}
|
||||
|
||||
@@ -2,4 +2,3 @@
|
||||
|
||||
export * from "../../jsTyping/_namespaces/ts.server";
|
||||
export * from "../../server/_namespaces/ts.server";
|
||||
export * from "../tsserverlibrary";
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
{
|
||||
"extends": "../tsconfig-library-base",
|
||||
"extends": "../tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../built/local"
|
||||
"outDir": "../../built/local/tsserverlibrary"
|
||||
},
|
||||
"files": [
|
||||
"tsserverlibrary.ts",
|
||||
"_namespaces/ts.server.ts",
|
||||
"_namespaces/ts.ts"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "../compiler" },
|
||||
{ "path": "../jsTyping" },
|
||||
{ "path": "../services" },
|
||||
{ "path": "../server" },
|
||||
{ "path": "../deprecatedCompat" }
|
||||
]
|
||||
],
|
||||
"include": ["**/*"]
|
||||
}
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
export { };
|
||||
import * as ts from "./_namespaces/ts";
|
||||
|
||||
// TODO(jakebailey): replace const enum with enum in d.ts
|
||||
|
||||
export = ts;
|
||||
|
||||
6
src/typescript/_namespaces/ts.ts
Normal file
6
src/typescript/_namespaces/ts.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
/* Generated file to emulate the ts namespace. */
|
||||
|
||||
export * from "../../compiler/_namespaces/ts";
|
||||
export * from "../../jsTyping/_namespaces/ts";
|
||||
export * from "../../services/_namespaces/ts";
|
||||
export * from "../../deprecatedCompat/_namespaces/ts";
|
||||
13
src/typescript/tsconfig.json
Normal file
13
src/typescript/tsconfig.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"extends": "../tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../built/local/typescript"
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../compiler" },
|
||||
{ "path": "../jsTyping" },
|
||||
{ "path": "../services" },
|
||||
{ "path": "../deprecatedCompat" }
|
||||
],
|
||||
"include": ["**/*"]
|
||||
}
|
||||
21
src/typescript/typescript.ts
Normal file
21
src/typescript/typescript.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import * as ts from "./_namespaces/ts";
|
||||
import { Debug, LogLevel } from "./_namespaces/ts";
|
||||
|
||||
// TODO(jakebailey): replace const enum with enum in d.ts
|
||||
|
||||
// enable deprecation logging
|
||||
declare const console: any;
|
||||
if (typeof console !== "undefined") {
|
||||
Debug.loggingHost = {
|
||||
log(level, s) {
|
||||
switch (level) {
|
||||
case LogLevel.Error: return console.error(s);
|
||||
case LogLevel.Warning: return console.warn(s);
|
||||
case LogLevel.Info: return console.log(s);
|
||||
case LogLevel.Verbose: return console.log(s);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export = ts;
|
||||
@@ -1,8 +1,7 @@
|
||||
{
|
||||
"extends": "../tsconfig-noncomposite-base",
|
||||
"extends": "../tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"removeComments": true,
|
||||
"outDir": "../../built/local",
|
||||
"outDir": "../../built/local/typingsInstaller",
|
||||
"types": [
|
||||
"node"
|
||||
],
|
||||
@@ -16,10 +15,5 @@
|
||||
{ "path": "../jsTyping" },
|
||||
{ "path": "../typingsInstallerCore" }
|
||||
],
|
||||
"files": [
|
||||
"nodeTypingsInstaller.ts",
|
||||
"_namespaces/ts.server.typingsInstaller.ts",
|
||||
"_namespaces/ts.ts",
|
||||
"_namespaces/ts.server.ts"
|
||||
]
|
||||
"include": ["**/*"]
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"extends": "../tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../built/local",
|
||||
"outDir": "../../built/local/typingsInstallerCore",
|
||||
"types": [
|
||||
"node"
|
||||
],
|
||||
@@ -14,10 +14,5 @@
|
||||
{ "path": "../compiler" },
|
||||
{ "path": "../jsTyping" }
|
||||
],
|
||||
"files": [
|
||||
"typingsInstaller.ts",
|
||||
"_namespaces/ts.server.typingsInstaller.ts",
|
||||
"_namespaces/ts.ts",
|
||||
"_namespaces/ts.server.ts"
|
||||
]
|
||||
"include": ["**/*"]
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
{
|
||||
"extends": "../tsconfig-noncomposite-base",
|
||||
"extends": "../tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"removeComments": true,
|
||||
"incremental": false,
|
||||
"outDir": "../../built/local",
|
||||
"outDir": "../../built/local/watchGuard",
|
||||
"types": [
|
||||
"node"
|
||||
],
|
||||
@@ -11,7 +9,5 @@
|
||||
"es6"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"watchGuard.ts"
|
||||
]
|
||||
"include": ["**/*"]
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
{
|
||||
"extends": "../tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"removeComments": false,
|
||||
"outDir": "../../built/local",
|
||||
"preserveConstEnums": true,
|
||||
"outDir": "../../built/local/webServer",
|
||||
"types": [
|
||||
"node"
|
||||
]
|
||||
@@ -14,9 +12,5 @@
|
||||
{ "path": "../services" },
|
||||
{ "path": "../server" }
|
||||
],
|
||||
"files": [
|
||||
"webServer.ts",
|
||||
"_namespaces/ts.server.ts",
|
||||
"_namespaces/ts.ts"
|
||||
]
|
||||
"include": ["**/*"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user