mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-01 03:54:20 -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,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 { };
|
||||
Reference in New Issue
Block a user