mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Add unittests:: on all unittests describe blocks for easy run
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("assert", () => {
|
||||
describe("unittests:: assert", () => {
|
||||
it("deepEqual", () => {
|
||||
assert.throws(() => assert.deepEqual(createNodeArray([createIdentifier("A")]), createNodeArray([createIdentifier("B")])));
|
||||
assert.throws(() => assert.deepEqual(createNodeArray([], /*hasTrailingComma*/ true), createNodeArray([], /*hasTrailingComma*/ false)));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("base64", () => {
|
||||
describe("unittests:: base64", () => {
|
||||
describe("base64decode", () => {
|
||||
it("can decode input strings correctly without needing a host implementation", () => {
|
||||
const tests = [
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("builder", () => {
|
||||
describe("unittests:: builder", () => {
|
||||
it("emits dependent files", () => {
|
||||
const files: NamedSourceText[] = [
|
||||
{ name: "/a.ts", text: SourceText.New("", 'import { b } from "./b";', "") },
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("compilerCore", () => {
|
||||
describe("unittests:: compilerCore", () => {
|
||||
describe("equalOwnProperties", () => {
|
||||
it("correctly equates objects", () => {
|
||||
assert.isTrue(equalOwnProperties({}, {}));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("config:: commandLineParsing:: parseCommandLine", () => {
|
||||
describe("unittests:: config:: commandLineParsing:: parseCommandLine", () => {
|
||||
|
||||
function assertParseResult(commandLine: string[], expectedParsedCommandLine: ParsedCommandLine) {
|
||||
const parsed = parseCommandLine(commandLine);
|
||||
@@ -367,7 +367,7 @@ namespace ts {
|
||||
});
|
||||
});
|
||||
|
||||
describe("config:: commandLineParsing:: parseBuildOptions", () => {
|
||||
describe("unittests:: config:: commandLineParsing:: parseBuildOptions", () => {
|
||||
function assertParseResult(commandLine: string[], expectedParsedBuildCommand: ParsedBuildCommand) {
|
||||
const parsed = parseBuildCommand(commandLine);
|
||||
const parsedBuildOptions = JSON.stringify(parsed.buildOptions);
|
||||
|
||||
@@ -208,7 +208,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
describe("config:: configurationExtension", () => {
|
||||
describe("unittests:: config:: configurationExtension", () => {
|
||||
forEach<[string, string, fakes.ParseConfigHost], void>([
|
||||
["under a case insensitive host", caseInsensitiveBasePath, caseInsensitiveHost],
|
||||
["under a case sensitive host", caseSensitiveBasePath, caseSensitiveHost]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("config:: convertCompilerOptionsFromJson", () => {
|
||||
describe("unittests:: config:: convertCompilerOptionsFromJson", () => {
|
||||
const formatDiagnosticHost: FormatDiagnosticsHost = {
|
||||
getCurrentDirectory: () => "/apath/",
|
||||
getCanonicalFileName: createGetCanonicalFileName(/*useCaseSensitiveFileNames*/ true),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace ts {
|
||||
interface ExpectedResult { typeAcquisition: TypeAcquisition; errors: Diagnostic[]; }
|
||||
describe("config:: convertTypeAcquisitionFromJson", () => {
|
||||
describe("unittests:: config:: convertTypeAcquisitionFromJson", () => {
|
||||
function assertTypeAcquisition(json: any, configFileName: string, expectedResult: ExpectedResult) {
|
||||
assertTypeAcquisitionWithJson(json, configFileName, expectedResult);
|
||||
assertTypeAcquisitionWithJsonNode(json, configFileName, expectedResult);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("config:: initTSConfig", () => {
|
||||
describe("unittests:: config:: initTSConfig", () => {
|
||||
function initTSConfigCorrectly(name: string, commandLinesArgs: string[]) {
|
||||
describe(name, () => {
|
||||
const commandLine = parseCommandLine(commandLinesArgs);
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace ts {
|
||||
return createFileDiagnostic(file, start, length, diagnosticMessage, arg0);
|
||||
}
|
||||
|
||||
describe("config:: matchFiles", () => {
|
||||
describe("unittests:: config:: matchFiles", () => {
|
||||
it("with defaults", () => {
|
||||
const json = {};
|
||||
const expected: ParsedCommandLine = {
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace ts {
|
||||
checkResult(prog, host);
|
||||
}
|
||||
|
||||
describe("config:: project-references meta check", () => {
|
||||
describe("unittests:: config:: project-references meta check", () => {
|
||||
it("default setup was created correctly", () => {
|
||||
const spec: TestSpecification = {
|
||||
"/primary": {
|
||||
@@ -118,7 +118,7 @@ namespace ts {
|
||||
/**
|
||||
* Validate that we enforce the basic settings constraints for referenced projects
|
||||
*/
|
||||
describe("config:: project-references constraint checking for settings", () => {
|
||||
describe("unittests:: config:: project-references constraint checking for settings", () => {
|
||||
it("errors when declaration = false", () => {
|
||||
const spec: TestSpecification = {
|
||||
"/primary": {
|
||||
@@ -248,7 +248,7 @@ namespace ts {
|
||||
/**
|
||||
* Path mapping behavior
|
||||
*/
|
||||
describe("config:: project-references path mapping", () => {
|
||||
describe("unittests:: config:: project-references path mapping", () => {
|
||||
it("redirects to the output .d.ts file", () => {
|
||||
const spec: TestSpecification = {
|
||||
"/alpha": {
|
||||
@@ -268,7 +268,7 @@ namespace ts {
|
||||
});
|
||||
});
|
||||
|
||||
describe("config:: project-references nice-behavior", () => {
|
||||
describe("unittests:: config:: project-references nice-behavior", () => {
|
||||
it("issues a nice error when the input file is missing", () => {
|
||||
const spec: TestSpecification = {
|
||||
"/alpha": {
|
||||
@@ -289,7 +289,7 @@ namespace ts {
|
||||
/**
|
||||
* 'composite' behavior
|
||||
*/
|
||||
describe("config:: project-references behavior changes under composite: true", () => {
|
||||
describe("unittests:: config:: project-references behavior changes under composite: true", () => {
|
||||
it("doesn't infer the rootDir from source paths", () => {
|
||||
const spec: TestSpecification = {
|
||||
"/alpha": {
|
||||
@@ -308,7 +308,7 @@ namespace ts {
|
||||
});
|
||||
});
|
||||
|
||||
describe("config:: project-references errors when a file in a composite project occurs outside the root", () => {
|
||||
describe("unittests:: config:: project-references errors when a file in a composite project occurs outside the root", () => {
|
||||
it("Errors when a file is outside the rootdir", () => {
|
||||
const spec: TestSpecification = {
|
||||
"/alpha": {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("config:: showConfig", () => {
|
||||
describe("unittests:: config:: showConfig", () => {
|
||||
function showTSConfigCorrectly(name: string, commandLinesArgs: string[], configJson?: object) {
|
||||
describe(name, () => {
|
||||
const outputFileName = `showConfig/${name.replace(/[^a-z0-9\-./ ]/ig, "")}/tsconfig.json`;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("config:: tsconfigParsing:: parseConfigFileTextToJson", () => {
|
||||
describe("unittests:: config:: tsconfigParsing:: parseConfigFileTextToJson", () => {
|
||||
function assertParseResult(jsonText: string, expectedConfigObject: { config?: any; error?: Diagnostic[] }) {
|
||||
const parsed = parseConfigFileTextToJson("/apath/tsconfig.json", jsonText);
|
||||
assert.equal(JSON.stringify(parsed), JSON.stringify(expectedConfigObject));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("convertToBase64", () => {
|
||||
describe("unittests:: convertToBase64", () => {
|
||||
function runTest(input: string): void {
|
||||
const actual = convertToBase64(input);
|
||||
const expected = sys.base64encode!(input);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("customTransforms", () => {
|
||||
describe("unittests:: customTransforms", () => {
|
||||
function emitsCorrectly(name: string, sources: { file: string, text: string }[], customTransformers: CustomTransformers, options: CompilerOptions = {}) {
|
||||
it(name, () => {
|
||||
const roots = sources.map(source => createSourceFile(source.file, source.text, ScriptTarget.ES2015));
|
||||
@@ -97,4 +97,4 @@ namespace ts {
|
||||
experimentalDecorators: true
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
describe("evaluation:: asyncArrowEvaluation", () => {
|
||||
describe("unittests:: evaluation:: asyncArrowEvaluation", () => {
|
||||
// https://github.com/Microsoft/TypeScript/issues/24722
|
||||
it("this capture (es5)", async () => {
|
||||
const result = evaluator.evaluateTypeScript(`
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
describe("evaluation:: asyncGeneratorEvaluation", () => {
|
||||
describe("unittests:: evaluation:: asyncGeneratorEvaluation", () => {
|
||||
it("return (es5)", async () => {
|
||||
const result = evaluator.evaluateTypeScript(`
|
||||
async function * g() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
describe("evaluation:: forAwaitOfEvaluation", () => {
|
||||
describe("unittests:: evaluation:: forAwaitOfEvaluation", () => {
|
||||
it("sync (es5)", async () => {
|
||||
const result = evaluator.evaluateTypeScript(`
|
||||
let i = 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("FactoryAPI", () => {
|
||||
describe("unittests:: FactoryAPI", () => {
|
||||
function assertSyntaxKind(node: Node, expected: SyntaxKind) {
|
||||
assert.strictEqual(node.kind, expected, `Actual: ${Debug.showSyntaxKind(node)} Expected: ${(ts as any).SyntaxKind[expected]}`);
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
describe("Incremental", () => {
|
||||
describe("unittests:: Incremental Parser", () => {
|
||||
it("Inserting into method", () => {
|
||||
const source = "class C {\r\n" +
|
||||
" public foo1() { }\r\n" +
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("JSDocParsing", () => {
|
||||
describe("unittests:: JSDocParsing", () => {
|
||||
describe("TypeExpressions", () => {
|
||||
function parsesCorrectly(name: string, content: string) {
|
||||
it(name, () => {
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
describe("moduleResolution:: Node module resolution - relative paths", () => {
|
||||
describe("unittests:: moduleResolution:: Node module resolution - relative paths", () => {
|
||||
|
||||
function testLoadAsFile(containingFileName: string, moduleFileNameNoExt: string, moduleName: string): void {
|
||||
for (const ext of supportedTSExtensions) {
|
||||
@@ -200,7 +200,7 @@ namespace ts {
|
||||
});
|
||||
});
|
||||
|
||||
describe("moduleResolution:: Node module resolution - non-relative paths", () => {
|
||||
describe("unittests:: moduleResolution:: Node module resolution - non-relative paths", () => {
|
||||
it("computes correct commonPrefix for moduleName cache", () => {
|
||||
const resolutionCache = createModuleResolutionCache("/", (f) => f);
|
||||
let cache = resolutionCache.getOrCreateCacheForModuleName("a");
|
||||
@@ -457,7 +457,7 @@ namespace ts {
|
||||
});
|
||||
});
|
||||
|
||||
describe("moduleResolution:: Relative imports", () => {
|
||||
describe("unittests:: moduleResolution:: Relative imports", () => {
|
||||
function test(files: Map<string>, currentDirectory: string, rootFiles: string[], expectedFilesCount: number, relativeNamesToCheck: string[]) {
|
||||
const options: CompilerOptions = { module: ModuleKind.CommonJS };
|
||||
const host: CompilerHost = {
|
||||
@@ -530,7 +530,7 @@ export = C;
|
||||
});
|
||||
});
|
||||
|
||||
describe("moduleResolution:: Files with different casing", () => {
|
||||
describe("unittests:: moduleResolution:: Files with different casing", () => {
|
||||
let library: SourceFile;
|
||||
function test(files: Map<string>, options: CompilerOptions, currentDirectory: string, useCaseSensitiveFileNames: boolean, rootFiles: string[], diagnosticCodes: number[]): void {
|
||||
const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames);
|
||||
@@ -651,7 +651,7 @@ import b = require("./moduleB");
|
||||
});
|
||||
});
|
||||
|
||||
describe("moduleResolution:: baseUrl augmented module resolution", () => {
|
||||
describe("unittests:: moduleResolution:: baseUrl augmented module resolution", () => {
|
||||
|
||||
it("module resolution without path mappings/rootDirs", () => {
|
||||
test(/*hasDirectoryExists*/ false);
|
||||
@@ -1098,7 +1098,7 @@ import b = require("./moduleB");
|
||||
});
|
||||
});
|
||||
|
||||
describe("moduleResolution:: ModuleResolutionHost.directoryExists", () => {
|
||||
describe("unittests:: moduleResolution:: ModuleResolutionHost.directoryExists", () => {
|
||||
it("No 'fileExists' calls if containing directory is missing", () => {
|
||||
const host: ModuleResolutionHost = {
|
||||
readFile: notImplemented,
|
||||
@@ -1111,7 +1111,7 @@ import b = require("./moduleB");
|
||||
});
|
||||
});
|
||||
|
||||
describe("moduleResolution:: Type reference directive resolution: ", () => {
|
||||
describe("unittests:: moduleResolution:: Type reference directive resolution: ", () => {
|
||||
function testWorker(hasDirectoryExists: boolean, typesRoot: string | undefined, typeDirective: string, primary: boolean, initialFile: File, targetFile: File, ...otherFiles: File[]) {
|
||||
const host = createModuleResolutionHost(hasDirectoryExists, ...[initialFile, targetFile].concat(...otherFiles));
|
||||
const result = resolveTypeReferenceDirective(typeDirective, initialFile.name, typesRoot ? { typeRoots: [typesRoot] } : {}, host);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("BigInt literal base conversions", () => {
|
||||
describe("unittests:: BigInt literal base conversions", () => {
|
||||
describe("parsePseudoBigInt", () => {
|
||||
const testNumbers: number[] = [];
|
||||
for (let i = 0; i < 1e3; i++) testNumbers.push(i);
|
||||
@@ -68,4 +68,4 @@ namespace ts {
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
describe("core paths", () => {
|
||||
describe("unittests:: core paths", () => {
|
||||
it("normalizeSlashes", () => {
|
||||
assert.strictEqual(ts.normalizeSlashes("a"), "a");
|
||||
assert.strictEqual(ts.normalizeSlashes("a/b"), "a/b");
|
||||
@@ -289,4 +289,4 @@ describe("core paths", () => {
|
||||
assert.strictEqual(ts.getRelativePathFromDirectory("file:///a/b/c", "file:///a/b", /*ignoreCase*/ false), "..");
|
||||
assert.strictEqual(ts.getRelativePathFromDirectory("file:///c:", "file:///d:", /*ignoreCase*/ false), "file:///d:/");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("PrinterAPI", () => {
|
||||
describe("unittests:: PrinterAPI", () => {
|
||||
function makePrintsCorrectly(prefix: string) {
|
||||
return function printsCorrectly(name: string, options: PrinterOptions, printCallback: (printer: Printer) => string) {
|
||||
it(name, () => {
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace ts {
|
||||
assert.equal(notFound.length, 0, `Not found ${notFound} in actual: ${missingPaths} expected: ${expected}`);
|
||||
}
|
||||
|
||||
describe("Program.getMissingFilePaths", () => {
|
||||
describe("unittests:: Program.getMissingFilePaths", () => {
|
||||
|
||||
const options: CompilerOptions = {
|
||||
noLib: true,
|
||||
@@ -127,7 +127,7 @@ namespace ts {
|
||||
});
|
||||
});
|
||||
|
||||
describe("Program.isSourceFileFromExternalLibrary", () => {
|
||||
describe("unittests:: Program.isSourceFileFromExternalLibrary", () => {
|
||||
it("works on redirect files", () => {
|
||||
// In this example '/node_modules/foo/index.d.ts' will redirect to '/node_modules/bar/node_modules/foo/index.d.ts'.
|
||||
const a = new documents.TextDocument("/a.ts", 'import * as bar from "bar"; import * as foo from "foo";');
|
||||
|
||||
@@ -210,7 +210,7 @@ namespace ts {
|
||||
checkCache("resolved type directives", program, fileName, expectedContent, f => f.resolvedTypeReferenceDirectiveNames, checkResolvedTypeDirective);
|
||||
}
|
||||
|
||||
describe("Reuse program structure:: General", () => {
|
||||
describe("unittests:: Reuse program structure:: General", () => {
|
||||
const target = ScriptTarget.Latest;
|
||||
const files: NamedSourceText[] = [
|
||||
{
|
||||
@@ -895,7 +895,7 @@ namespace ts {
|
||||
});
|
||||
});
|
||||
|
||||
describe("Reuse program structure:: host is optional", () => {
|
||||
describe("unittests:: Reuse program structure:: host is optional", () => {
|
||||
it("should work if host is not provided", () => {
|
||||
createProgram([], {});
|
||||
});
|
||||
@@ -905,7 +905,7 @@ namespace ts {
|
||||
import createTestSystem = TestFSWithWatch.createWatchedSystem;
|
||||
import libFile = TestFSWithWatch.libFile;
|
||||
|
||||
describe("Reuse program structure:: isProgramUptoDate should return true when there is no change in compiler options and", () => {
|
||||
describe("unittests:: Reuse program structure:: isProgramUptoDate should return true when there is no change in compiler options and", () => {
|
||||
function verifyProgramIsUptoDate(
|
||||
program: Program,
|
||||
newRootFileNames: string[],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace ts {
|
||||
import theory = utils.theory;
|
||||
describe("semver", () => {
|
||||
describe("unittests:: semver", () => {
|
||||
describe("Version", () => {
|
||||
function assertVersion(version: Version, [major, minor, patch, prerelease, build]: [number, number, number, string[]?, string[]?]) {
|
||||
assert.strictEqual(version.major, major);
|
||||
@@ -225,4 +225,4 @@ namespace ts {
|
||||
]);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("services:: cancellableLanguageServiceOperations", () => {
|
||||
describe("unittests:: services:: cancellableLanguageServiceOperations", () => {
|
||||
const file = `
|
||||
function foo(): void;
|
||||
function foo<T>(x: T): T;
|
||||
|
||||
@@ -6,7 +6,7 @@ interface ClassificationEntry {
|
||||
position?: number;
|
||||
}
|
||||
|
||||
describe("services:: Colorization", () => {
|
||||
describe("unittests:: services:: Colorization", () => {
|
||||
// Use the shim adapter to ensure test coverage of the shim layer for the classifier
|
||||
const languageServiceAdapter = new Harness.LanguageService.ShimLanguageServiceAdapter(/*preprocessToResolve*/ false);
|
||||
const classifier = languageServiceAdapter.getClassifier();
|
||||
|
||||
@@ -343,7 +343,7 @@ interface Array<T> {}`
|
||||
}
|
||||
}
|
||||
|
||||
describe("services:: convertToAsyncFunctions", () => {
|
||||
describe("unittests:: services:: convertToAsyncFunctions", () => {
|
||||
_testConvertToAsyncFunction("convertToAsyncFunction_basic", `
|
||||
function [#|f|](): Promise<void>{
|
||||
return fetch('https://typescriptlang.org').then(result => { console.log(result) });
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
describe("services:: DocumentRegistry", () => {
|
||||
describe("unittests:: services:: DocumentRegistry", () => {
|
||||
it("documents are shared between projects", () => {
|
||||
const documentRegistry = ts.createDocumentRegistry();
|
||||
const defaultCompilerOptions = ts.getDefaultCompilerOptions();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("services:: extract:: extractConstants", () => {
|
||||
describe("unittests:: services:: extract:: extractConstants", () => {
|
||||
testExtractConstant("extractConstant_TopLevel",
|
||||
`let x = [#|1|];`);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("services:: extract:: extractFunctions", () => {
|
||||
describe("unittests:: services:: extract:: extractFunctions", () => {
|
||||
testExtractFunction("extractFunction1",
|
||||
`namespace A {
|
||||
let x = 1;
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
describe("services:: extract:: extractRanges", () => {
|
||||
describe("unittests:: services:: extract:: extractRanges", () => {
|
||||
it("get extract range from selection", () => {
|
||||
testExtractRange(`
|
||||
[#|
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("services:: extract:: Symbol Walker", () => {
|
||||
describe("unittests:: services:: extract:: Symbol Walker", () => {
|
||||
function test(description: string, source: string, verifier: (file: SourceFile, checker: TypeChecker) => void) {
|
||||
it(description, () => {
|
||||
const result = Harness.Compiler.compileFiles([{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("services:: hostNewLineSupport", () => {
|
||||
describe("unittests:: services:: hostNewLineSupport", () => {
|
||||
function testLSWithFiles(settings: CompilerOptions, files: Harness.Compiler.TestFile[]) {
|
||||
function snapFor(path: string): IScriptSnapshot | undefined {
|
||||
if (path === "lib.d.ts") {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("services:: languageService", () => {
|
||||
describe("unittests:: services:: languageService", () => {
|
||||
const files: {[index: string]: string} = {
|
||||
"foo.ts": `import Vue from "./vue";
|
||||
import Component from "./vue-class-component";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("services:: Organize imports", () => {
|
||||
describe("unittests:: services:: Organize imports", () => {
|
||||
describe("Sort imports", () => {
|
||||
it("Sort - non-relative vs non-relative", () => {
|
||||
assertSortsBefore(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
describe("services:: PatternMatcher", () => {
|
||||
describe("unittests:: services:: PatternMatcher", () => {
|
||||
describe("BreakIntoCharacterSpans", () => {
|
||||
it("EmptyIdentifier", () => {
|
||||
verifyBreakIntoCharacterSpans("");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
describe("services:: PreProcessFile:", () => {
|
||||
describe("unittests:: services:: PreProcessFile:", () => {
|
||||
function test(sourceText: string, readImportFile: boolean, detectJavaScriptImports: boolean, expectedPreProcess: ts.PreProcessedFileInfo): void {
|
||||
const resultPreProcess = ts.preProcessFile(sourceText, readImportFile, detectJavaScriptImports);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// tslint:disable trim-trailing-whitespace
|
||||
|
||||
namespace ts {
|
||||
describe("services:: textChanges", () => {
|
||||
describe("unittests:: services:: textChanges", () => {
|
||||
function findChild(name: string, n: Node) {
|
||||
return find(n)!;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("services:: Transpile", () => {
|
||||
describe("unittests:: services:: Transpile", () => {
|
||||
|
||||
interface TranspileTestSettings {
|
||||
options?: TranspileOptions;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("TransformAPI", () => {
|
||||
describe("unittests:: TransformAPI", () => {
|
||||
function replaceUndefinedWithVoid0(context: TransformationContext) {
|
||||
const previousOnSubstituteNode = context.onSubstituteNode;
|
||||
context.enableSubstitution(SyntaxKind.Identifier);
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace ts {
|
||||
"/src/core/index.js", "/src/core/index.d.ts", "/src/core/index.d.ts.map",
|
||||
"/src/logic/index.js", "/src/logic/index.js.map", "/src/logic/index.d.ts"];
|
||||
|
||||
describe("tsbuild - sanity check of clean build of 'sample1' project", () => {
|
||||
describe("unittests:: tsbuild - sanity check of clean build of 'sample1' project", () => {
|
||||
it("can build the sample project 'sample1' without error", () => {
|
||||
const fs = projFs.shadow();
|
||||
const host = new fakes.SolutionBuilderHost(fs);
|
||||
@@ -61,7 +61,7 @@ namespace ts {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsbuild - dry builds", () => {
|
||||
describe("unittests:: tsbuild - dry builds", () => {
|
||||
it("doesn't write any files in a dry build", () => {
|
||||
const fs = projFs.shadow();
|
||||
const host = new fakes.SolutionBuilderHost(fs);
|
||||
@@ -90,7 +90,7 @@ namespace ts {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsbuild - clean builds", () => {
|
||||
describe("unittests:: tsbuild - clean builds", () => {
|
||||
it("removes all files it built", () => {
|
||||
const fs = projFs.shadow();
|
||||
const host = new fakes.SolutionBuilderHost(fs);
|
||||
@@ -111,7 +111,7 @@ namespace ts {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsbuild - force builds", () => {
|
||||
describe("unittests:: tsbuild - force builds", () => {
|
||||
it("always builds under --force", () => {
|
||||
const fs = projFs.shadow();
|
||||
const host = new fakes.SolutionBuilderHost(fs);
|
||||
@@ -137,7 +137,7 @@ namespace ts {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsbuild - can detect when and what to rebuild", () => {
|
||||
describe("unittests:: tsbuild - can detect when and what to rebuild", () => {
|
||||
const fs = projFs.shadow();
|
||||
const host = new fakes.SolutionBuilderHost(fs);
|
||||
const builder = createSolutionBuilder(host, ["/src/tests"], { dry: false, force: false, verbose: true });
|
||||
@@ -200,7 +200,7 @@ namespace ts {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsbuild - downstream-blocked compilations", () => {
|
||||
describe("unittests:: tsbuild - downstream-blocked compilations", () => {
|
||||
it("won't build downstream projects if upstream projects have errors", () => {
|
||||
const fs = projFs.shadow();
|
||||
const host = new fakes.SolutionBuilderHost(fs);
|
||||
@@ -222,7 +222,7 @@ namespace ts {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsbuild - project invalidation", () => {
|
||||
describe("unittests:: tsbuild - project invalidation", () => {
|
||||
it("invalidates projects correctly", () => {
|
||||
const fs = projFs.shadow();
|
||||
const host = new fakes.SolutionBuilderHost(fs);
|
||||
@@ -270,7 +270,7 @@ export class cNew {}`);
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsbuild - with resolveJsonModule option", () => {
|
||||
describe("unittests:: tsbuild - with resolveJsonModule option", () => {
|
||||
const projFs = loadProjectFromDisk("tests/projects/resolveJsonModuleAndComposite");
|
||||
const allExpectedOutputs = ["/src/tests/dist/src/index.js", "/src/tests/dist/src/index.d.ts", "/src/tests/dist/src/hello.json"];
|
||||
|
||||
@@ -320,7 +320,7 @@ export default hello.hello`);
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsbuild - lists files", () => {
|
||||
describe("unittests:: tsbuild - lists files", () => {
|
||||
it("listFiles", () => {
|
||||
const fs = projFs.shadow();
|
||||
const host = new fakes.SolutionBuilderHost(fs);
|
||||
@@ -369,7 +369,7 @@ export default hello.hello`);
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsbuild - with rootDir of project reference in parentDirectory", () => {
|
||||
describe("unittests:: tsbuild - with rootDir of project reference in parentDirectory", () => {
|
||||
const projFs = loadProjectFromDisk("tests/projects/projectReferenceWithRootDirInParent");
|
||||
const allExpectedOutputs = [
|
||||
"/src/dist/other/other.js", "/src/dist/other/other.d.ts",
|
||||
@@ -388,7 +388,7 @@ export default hello.hello`);
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsbuild - when project reference is referenced transitively", () => {
|
||||
describe("unittests:: tsbuild - when project reference is referenced transitively", () => {
|
||||
const projFs = loadProjectFromDisk("tests/projects/transitiveReferences");
|
||||
const allExpectedOutputs = [
|
||||
"/src/a.js", "/src/a.d.ts",
|
||||
@@ -460,7 +460,7 @@ export const b = new A();`);
|
||||
export namespace OutFile {
|
||||
const outFileFs = loadProjectFromDisk("tests/projects/outfile-concat");
|
||||
|
||||
describe("tsbuild - baseline sectioned sourcemaps", () => {
|
||||
describe("unittests:: tsbuild - baseline sectioned sourcemaps", () => {
|
||||
let fs: vfs.FileSystem | undefined;
|
||||
before(() => {
|
||||
fs = outFileFs.shadow();
|
||||
@@ -480,7 +480,7 @@ export const b = new A();`);
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsbuild - downstream prepend projects always get rebuilt", () => {
|
||||
describe("unittests:: tsbuild - downstream prepend projects always get rebuilt", () => {
|
||||
it("", () => {
|
||||
const fs = outFileFs.shadow();
|
||||
const host = new fakes.SolutionBuilderHost(fs);
|
||||
@@ -508,7 +508,7 @@ export const b = new A();`);
|
||||
"/src/core/index.d.ts.map",
|
||||
];
|
||||
|
||||
describe("tsbuild - empty files option in tsconfig", () => {
|
||||
describe("unittests:: tsbuild - empty files option in tsconfig", () => {
|
||||
it("has empty files diagnostic when files is empty and no references are provided", () => {
|
||||
const fs = projFs.shadow();
|
||||
const host = new fakes.SolutionBuilderHost(fs);
|
||||
@@ -541,7 +541,7 @@ export const b = new A();`);
|
||||
});
|
||||
}
|
||||
|
||||
describe("tsbuild - graph-ordering", () => {
|
||||
describe("unittests:: tsbuild - graph-ordering", () => {
|
||||
let host: fakes.SolutionBuilderHost | undefined;
|
||||
const deps: [string, string][] = [
|
||||
["A", "B"],
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace ts.tscWatch {
|
||||
return solutionBuilder;
|
||||
}
|
||||
|
||||
describe("tsbuild-watch program updates", () => {
|
||||
describe("unittests:: tsbuild-watch program updates", () => {
|
||||
const project = "sample1";
|
||||
const enum SubProject {
|
||||
core = "core",
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace ts.tscWatch {
|
||||
checkOutputDoesNotContain(host, expectedNonAffectedFiles);
|
||||
}
|
||||
|
||||
describe("tsc-watch:: emit with outFile or out setting", () => {
|
||||
describe("unittests:: tsc-watch:: emit with outFile or out setting", () => {
|
||||
function createWatchForOut(out?: string, outFile?: string) {
|
||||
const host = createWatchedSystem([]);
|
||||
const config: FileOrFolderEmit = {
|
||||
@@ -161,7 +161,7 @@ namespace ts.tscWatch {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsc-watch:: emit for configured projects", () => {
|
||||
describe("unittests:: tsc-watch:: emit for configured projects", () => {
|
||||
const file1Consumer1Path = "/a/b/file1Consumer1.ts";
|
||||
const moduleFile1Path = "/a/b/moduleFile1.ts";
|
||||
const configFilePath = "/a/b/tsconfig.json";
|
||||
@@ -495,7 +495,7 @@ namespace ts.tscWatch {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsc-watch:: emit file content", () => {
|
||||
describe("unittests:: tsc-watch:: emit file content", () => {
|
||||
interface EmittedFile extends File {
|
||||
shouldBeWritten: boolean;
|
||||
}
|
||||
@@ -676,7 +676,7 @@ namespace ts.tscWatch {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsc-watch:: emit with when module emit is specified as node", () => {
|
||||
describe("unittests:: tsc-watch:: emit with when module emit is specified as node", () => {
|
||||
it("when instead of filechanged recursive directory watcher is invoked", () => {
|
||||
const configFile: File = {
|
||||
path: "/a/rootFolder/project/tsconfig.json",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.tscWatch {
|
||||
describe("tsc-watch:: resolutionCache:: tsc-watch module resolution caching", () => {
|
||||
describe("unittests:: tsc-watch:: resolutionCache:: tsc-watch module resolution caching", () => {
|
||||
it("works", () => {
|
||||
const root = {
|
||||
path: "/a/d/f0.ts",
|
||||
@@ -404,7 +404,7 @@ declare module "fs" {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsc-watch:: resolutionCache:: tsc-watch with modules linked to sibling folder", () => {
|
||||
describe("unittests:: tsc-watch:: resolutionCache:: tsc-watch with modules linked to sibling folder", () => {
|
||||
const projectRoot = "/user/username/projects/project";
|
||||
const mainPackageRoot = `${projectRoot}/main`;
|
||||
const linkedPackageRoot = `${projectRoot}/linked-package`;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.tscWatch {
|
||||
describe("tsc-watch:: watchAPI:: tsc-watch with custom module resolution", () => {
|
||||
describe("unittests:: tsc-watch:: watchAPI:: tsc-watch with custom module resolution", () => {
|
||||
const projectRoot = "/user/username/projects/project";
|
||||
const configFileJson: any = {
|
||||
compilerOptions: { module: "commonjs", resolveJsonModule: true },
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace ts.tscWatch {
|
||||
import Tsc_WatchDirectory = TestFSWithWatch.Tsc_WatchDirectory;
|
||||
describe("tsc-watch:: watchEnvironment:: tsc-watch with different polling/non polling options", () => {
|
||||
describe("unittests:: tsc-watch:: watchEnvironment:: tsc-watch with different polling/non polling options", () => {
|
||||
it("watchFile using dynamic priority polling", () => {
|
||||
const projectFolder = "/a/username/project";
|
||||
const file1: File = {
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace ts.projectSystem {
|
||||
return countWhere(recursiveWatchedDirs, dir => file.length > dir.length && startsWith(file, dir) && file[dir.length] === directorySeparator);
|
||||
}
|
||||
|
||||
describe("tsserver:: CachingFileSystemInformation:: tsserverProjectSystem CachingFileSystemInformation", () => {
|
||||
describe("unittests:: tsserver:: CachingFileSystemInformation:: tsserverProjectSystem CachingFileSystemInformation", () => {
|
||||
enum CalledMapsWithSingleArg {
|
||||
fileExists = "fileExists",
|
||||
directoryExists = "directoryExists",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: cancellationToken", () => {
|
||||
describe("unittests:: tsserver:: cancellationToken", () => {
|
||||
// Disable sourcemap support for the duration of the test, as sourcemapping the errors generated during this test is slow and not something we care to test
|
||||
let oldPrepare: AnyFunction;
|
||||
before(() => {
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace ts.projectSystem {
|
||||
return new TestTypingsInstaller("/a/data/", /*throttleLimit*/5, host);
|
||||
}
|
||||
|
||||
describe("tsserver:: compileOnSave:: affected list", () => {
|
||||
describe("unittests:: tsserver:: compileOnSave:: affected list", () => {
|
||||
function sendAffectedFileRequestAndCheckResult(session: server.Session, request: server.protocol.Request, expectedFileList: { projectFileName: string, files: File[] }[]) {
|
||||
const response = session.executeCommand(request).response as server.protocol.CompileOnSaveAffectedFileListSingleProject[];
|
||||
const actualResult = response.sort((list1, list2) => compareStringsCaseSensitive(list1.projectFileName, list2.projectFileName));
|
||||
@@ -552,7 +552,7 @@ namespace ts.projectSystem {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsserver:: compileOnSave:: EmitFile test", () => {
|
||||
describe("unittests:: tsserver:: compileOnSave:: EmitFile test", () => {
|
||||
it("should respect line endings", () => {
|
||||
test("\n");
|
||||
test("\r\n");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: completions", () => {
|
||||
describe("unittests:: tsserver:: completions", () => {
|
||||
it("works", () => {
|
||||
const aTs: File = {
|
||||
path: "/a.ts",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: searching for config file", () => {
|
||||
describe("unittests:: tsserver:: searching for config file", () => {
|
||||
it("should stop at projectRootPath if given", () => {
|
||||
const f1 = {
|
||||
path: "/a/file1.ts",
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace ts.projectSystem {
|
||||
assert.deepEqual(output.outputFiles, expectedFiles.map((e): OutputFile => ({ name: e.path, text: e.content, writeByteOrderMark: false })));
|
||||
}
|
||||
|
||||
describe("tsserver:: with declaration file maps:: project references", () => {
|
||||
describe("unittests:: tsserver:: with declaration file maps:: project references", () => {
|
||||
const aTs: File = {
|
||||
path: "/a/a.ts",
|
||||
content: "export function fnA() {}\nexport interface IfaceA {}\nexport const instanceA: IfaceA = {};",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: document registry in project service", () => {
|
||||
describe("unittests:: tsserver:: document registry in project service", () => {
|
||||
const projectRootPath = "/user/username/projects/project";
|
||||
const importModuleContent = `import {a} from "./module1"`;
|
||||
const file: File = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: duplicate packages", () => {
|
||||
describe("unittests:: tsserver:: duplicate packages", () => {
|
||||
// Tests that 'moduleSpecifiers.ts' will import from the redirecting file, and not from the file it redirects to, if that can provide a global module specifier.
|
||||
it("works with import fixes", () => {
|
||||
const packageContent = "export const foo: number;";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: LargeFileReferencedEvent with large file", () => {
|
||||
describe("unittests:: tsserver:: events:: LargeFileReferencedEvent with large file", () => {
|
||||
const projectRoot = "/user/username/projects/project";
|
||||
|
||||
function getLargeFile(useLargeTsFile: boolean) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: events:: ProjectLoadingStart and ProjectLoadingFinish events", () => {
|
||||
describe("unittests:: tsserver:: events:: ProjectLoadingStart and ProjectLoadingFinish events", () => {
|
||||
const projectRoot = "/user/username/projects";
|
||||
const aTs: File = {
|
||||
path: `${projectRoot}/a/a.ts`,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: ProjectsUpdatedInBackground", () => {
|
||||
describe("unittests:: tsserver:: events:: ProjectsUpdatedInBackground", () => {
|
||||
function verifyFiles(caption: string, actual: ReadonlyArray<string>, expected: ReadonlyArray<string>) {
|
||||
assert.equal(actual.length, expected.length, `Incorrect number of ${caption}. Actual: ${actual} Expected: ${expected}`);
|
||||
const seen = createMap<true>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: ExternalProjects", () => {
|
||||
describe("unittests:: tsserver:: ExternalProjects", () => {
|
||||
describe("correctly handling add/remove tsconfig - 1", () => {
|
||||
function verifyAddRemoveConfig(lazyConfiguredProjectsFromExternalProject: boolean) {
|
||||
const f1 = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: forceConsistentCasingInFileNames", () => {
|
||||
describe("unittests:: tsserver:: forceConsistentCasingInFileNames", () => {
|
||||
it("works when extends is specified with a case insensitive file system", () => {
|
||||
const rootPath = "/Users/username/dev/project";
|
||||
const file1: File = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: format settings", () => {
|
||||
describe("unittests:: tsserver:: format settings", () => {
|
||||
it("can be set globally", () => {
|
||||
const f1 = {
|
||||
path: "/a/b/app.ts",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: getEditsForFileRename", () => {
|
||||
describe("unittests:: tsserver:: getEditsForFileRename", () => {
|
||||
it("works for host implementing 'resolveModuleNames' and 'getResolvedModuleWithFailedLookupLocationsFromCache'", () => {
|
||||
const userTs: File = {
|
||||
path: "/user.ts",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: import helpers", () => {
|
||||
describe("unittests:: tsserver:: import helpers", () => {
|
||||
it("should not crash in tsserver", () => {
|
||||
const f1 = {
|
||||
path: "/a/app.ts",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: Inferred projects", () => {
|
||||
describe("unittests:: tsserver:: Inferred projects", () => {
|
||||
it("should support files without extensions", () => {
|
||||
const f = {
|
||||
path: "/a/compile",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: Language service", () => {
|
||||
describe("unittests:: tsserver:: Language service", () => {
|
||||
it("should work correctly on case-sensitive file systems", () => {
|
||||
const lib = {
|
||||
path: "/a/Lib/lib.d.ts",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: maxNodeModuleJsDepth for inferred projects", () => {
|
||||
describe("unittests:: tsserver:: maxNodeModuleJsDepth for inferred projects", () => {
|
||||
it("should be set to 2 if the project has js root files", () => {
|
||||
const file1: File = {
|
||||
path: "/a/b/file1.js",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: with metadata in response", () => {
|
||||
describe("unittests:: tsserver:: with metadata in response", () => {
|
||||
const metadata = "Extra Info";
|
||||
function verifyOutput(host: TestServerHost, expectedResponse: protocol.Response) {
|
||||
const output = host.getOutput().map(mapOutputToJson);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: navigate-to for javascript project", () => {
|
||||
describe("unittests:: tsserver:: navigate-to for javascript project", () => {
|
||||
function containsNavToItem(items: protocol.NavtoItem[], itemName: string, itemKind: string) {
|
||||
return find(items, item => item.name === itemName && item.kind === itemKind) !== undefined;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: occurence highlight on string", () => {
|
||||
describe("unittests:: tsserver:: occurence highlight on string", () => {
|
||||
it("should be marked if only on string values", () => {
|
||||
const file1: File = {
|
||||
path: "/a/b/file1.ts",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: Open-file", () => {
|
||||
describe("unittests:: tsserver:: Open-file", () => {
|
||||
it("can be reloaded with empty content", () => {
|
||||
const f = {
|
||||
path: "/a/b/app.ts",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: Project Errors", () => {
|
||||
describe("unittests:: tsserver:: Project Errors", () => {
|
||||
function checkProjectErrors(projectFiles: server.ProjectFilesWithTSDiagnostics, expectedErrors: ReadonlyArray<string>): void {
|
||||
assert.isTrue(projectFiles !== undefined, "missing project files");
|
||||
checkProjectErrorsWorker(projectFiles.projectErrors, expectedErrors);
|
||||
@@ -200,7 +200,7 @@ namespace ts.projectSystem {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsserver:: Project Errors are reported as appropriate", () => {
|
||||
describe("unittests:: tsserver:: Project Errors are reported as appropriate", () => {
|
||||
function createErrorLogger() {
|
||||
let hasError = false;
|
||||
const errorLogger: server.Logger = {
|
||||
@@ -481,7 +481,7 @@ namespace ts.projectSystem {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsserver:: Project Errors for Configure file diagnostics events", () => {
|
||||
describe("unittests:: tsserver:: Project Errors for Configure file diagnostics events", () => {
|
||||
function getUnknownCompilerOptionDiagnostic(configFile: File, prop: string): ConfigFileDiagnostic {
|
||||
const d = Diagnostics.Unknown_compiler_option_0;
|
||||
const start = configFile.content.indexOf(prop) - 1; // start at "prop"
|
||||
@@ -671,7 +671,7 @@ namespace ts.projectSystem {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsserver:: Project Errors dont include overwrite emit error", () => {
|
||||
describe("unittests:: tsserver:: Project Errors dont include overwrite emit error", () => {
|
||||
it("for inferred project", () => {
|
||||
const f1 = {
|
||||
path: "/a/b/f1.js",
|
||||
@@ -754,7 +754,7 @@ namespace ts.projectSystem {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsserver:: Project Errors reports Options Diagnostic locations correctly with changes in configFile contents", () => {
|
||||
describe("unittests:: tsserver:: Project Errors reports Options Diagnostic locations correctly with changes in configFile contents", () => {
|
||||
it("when options change", () => {
|
||||
const file = {
|
||||
path: "/a/b/app.ts",
|
||||
@@ -818,7 +818,7 @@ namespace ts.projectSystem {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsserver:: Project Errors with config file change", () => {
|
||||
describe("unittests:: tsserver:: Project Errors with config file change", () => {
|
||||
it("Updates diagnostics when '--noUnusedLabels' changes", () => {
|
||||
const aTs: File = { path: "/a.ts", content: "label: while (1) {}" };
|
||||
const options = (allowUnusedLabels: boolean) => `{ "compilerOptions": { "allowUnusedLabels": ${allowUnusedLabels} } }`;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: with project references and tsbuild", () => {
|
||||
describe("unittests:: tsserver:: with project references and tsbuild", () => {
|
||||
function createHost(files: ReadonlyArray<File>, rootNames: ReadonlyArray<string>) {
|
||||
const host = createServerHost(files);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: refactors", () => {
|
||||
describe("unittests:: tsserver:: refactors", () => {
|
||||
it("use formatting options", () => {
|
||||
const file = {
|
||||
path: "/a.ts",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: reload", () => {
|
||||
describe("unittests:: tsserver:: reload", () => {
|
||||
it("should work with temp file", () => {
|
||||
const f1 = {
|
||||
path: "/a/b/app.ts",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: rename", () => {
|
||||
describe("unittests:: tsserver:: rename", () => {
|
||||
it("works with fileToRename", () => {
|
||||
const aTs: File = { path: "/a.ts", content: "export const a = 0;" };
|
||||
const bTs: File = { path: "/b.ts", content: 'import { a } from "./a";' };
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace ts.projectSystem {
|
||||
return resolutionTrace;
|
||||
}
|
||||
|
||||
describe("tsserver:: resolutionCache:: tsserverProjectSystem extra resolution pass in lshost", () => {
|
||||
describe("unittests:: tsserver:: resolutionCache:: tsserverProjectSystem extra resolution pass in lshost", () => {
|
||||
it("can load typings that are proper modules", () => {
|
||||
const file1 = {
|
||||
path: "/a/b/app.js",
|
||||
@@ -46,7 +46,7 @@ namespace ts.projectSystem {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsserver:: resolutionCache:: tsserverProjectSystem watching @types", () => {
|
||||
describe("unittests:: tsserver:: resolutionCache:: tsserverProjectSystem watching @types", () => {
|
||||
it("works correctly when typings are added or removed", () => {
|
||||
const f1 = {
|
||||
path: "/a/b/app.ts",
|
||||
@@ -92,7 +92,7 @@ namespace ts.projectSystem {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsserver:: resolutionCache:: tsserverProjectSystem add the missing module file for inferred project", () => {
|
||||
describe("unittests:: tsserver:: resolutionCache:: tsserverProjectSystem add the missing module file for inferred project", () => {
|
||||
it("should remove the `module not found` error", () => {
|
||||
const moduleFile = {
|
||||
path: "/a/b/moduleFile.ts",
|
||||
@@ -358,7 +358,7 @@ namespace ts.projectSystem {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsserver:: resolutionCache:: tsserverProjectSystem rename a module file and rename back", () => {
|
||||
describe("unittests:: tsserver:: resolutionCache:: tsserverProjectSystem rename a module file and rename back", () => {
|
||||
it("should restore the states for inferred projects", () => {
|
||||
const moduleFile = {
|
||||
path: "/a/b/moduleFile.ts",
|
||||
@@ -493,7 +493,7 @@ namespace ts.projectSystem {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsserver:: resolutionCache:: tsserverProjectSystem module resolution caching", () => {
|
||||
describe("unittests:: tsserver:: resolutionCache:: tsserverProjectSystem module resolution caching", () => {
|
||||
const projectLocation = "/user/username/projects/myproject";
|
||||
const configFile: File = {
|
||||
path: `${projectLocation}/tsconfig.json`,
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
describe("tsserver:: Session:: General functionality", () => {
|
||||
describe("unittests:: tsserver:: Session:: General functionality", () => {
|
||||
let session: TestSession;
|
||||
let lastSent: protocol.Message;
|
||||
|
||||
@@ -418,7 +418,7 @@ namespace ts.server {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsserver:: Session:: exceptions", () => {
|
||||
describe("unittests:: tsserver:: Session:: exceptions", () => {
|
||||
|
||||
// Disable sourcemap support for the duration of the test, as sourcemapping the errors generated during this test is slow and not something we care to test
|
||||
let oldPrepare: AnyFunction;
|
||||
@@ -489,7 +489,7 @@ namespace ts.server {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsserver:: Session:: how Session is extendable via subclassing", () => {
|
||||
describe("unittests:: tsserver:: Session:: how Session is extendable via subclassing", () => {
|
||||
class TestSession extends Session {
|
||||
lastSent: protocol.Message | undefined;
|
||||
customHandler = "testhandler";
|
||||
@@ -558,7 +558,7 @@ namespace ts.server {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsserver:: Session:: an example of using the Session API to create an in-process server", () => {
|
||||
describe("unittests:: tsserver:: Session:: an example of using the Session API to create an in-process server", () => {
|
||||
class InProcSession extends Session {
|
||||
private queue: protocol.Request[] = [];
|
||||
constructor(private client: InProcClient) {
|
||||
@@ -710,7 +710,7 @@ namespace ts.server {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsserver:: Session:: helpers", () => {
|
||||
describe("unittests:: tsserver:: Session:: helpers", () => {
|
||||
it(getLocationInNewDocument.name, () => {
|
||||
const text = `// blank line\nconst x = 0;`;
|
||||
const renameLocationInOldText = text.indexOf("0");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: with skipLibCheck", () => {
|
||||
describe("unittests:: tsserver:: with skipLibCheck", () => {
|
||||
it("should be turned on for js-only inferred projects", () => {
|
||||
const file1 = {
|
||||
path: "/a/b/file1.js",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: symLinks", () => {
|
||||
describe("unittests:: tsserver:: symLinks", () => {
|
||||
it("rename in common file renames all project", () => {
|
||||
const projects = "/users/username/projects";
|
||||
const folderA = `${projects}/a`;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: syntax operations", () => {
|
||||
describe("unittests:: tsserver:: syntax operations", () => {
|
||||
function navBarFull(session: TestSession, file: File) {
|
||||
return JSON.stringify(session.executeCommandSeq<protocol.FileRequest>({
|
||||
command: protocol.CommandTypes.NavBarFull,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: project telemetry", () => {
|
||||
describe("unittests:: tsserver:: project telemetry", () => {
|
||||
it("does nothing for inferred project", () => {
|
||||
const file = makeFile("/a.js");
|
||||
const et = new TestServerEventManager([file]);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.textStorage {
|
||||
describe("tsserver:: Text storage", () => {
|
||||
describe("unittests:: tsserver:: Text storage", () => {
|
||||
const f = {
|
||||
path: "/a/app.ts",
|
||||
content: `
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: autoDiscovery", () => {
|
||||
describe("unittests:: tsserver:: autoDiscovery", () => {
|
||||
it("does not depend on extension", () => {
|
||||
const file1 = {
|
||||
path: "/a/b/app.html",
|
||||
@@ -22,7 +22,7 @@ namespace ts.projectSystem {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsserver:: prefer typings to js", () => {
|
||||
describe("unittests:: tsserver:: prefer typings to js", () => {
|
||||
it("during second resolution pass", () => {
|
||||
const typingsCacheLocation = "/a/typings";
|
||||
const f1 = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: typeReferenceDirectives", () => {
|
||||
describe("unittests:: tsserver:: typeReferenceDirectives", () => {
|
||||
it("when typeReferenceDirective contains UpperCasePackage", () => {
|
||||
const projectLocation = "/user/username/projects/myproject";
|
||||
const libProjectLocation = `${projectLocation}/lib`;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("tsserver:: Untitled files", () => {
|
||||
describe("unittests:: tsserver:: Untitled files", () => {
|
||||
it("Can convert positions to locations", () => {
|
||||
const aTs: File = { path: "/proj/a.ts", content: "" };
|
||||
const tsconfig: File = { path: "/proj/tsconfig.json", content: "{}" };
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace ts {
|
||||
assert.equal(editedText, checkText);
|
||||
}
|
||||
|
||||
describe(`tsserver:: VersionCache TS code`, () => {
|
||||
describe(`unittests:: tsserver:: VersionCache TS code`, () => {
|
||||
let validateEditAtLineCharIndex: (line: number, char: number, deleteLength: number, insertString: string) => void;
|
||||
|
||||
before(() => {
|
||||
@@ -77,7 +77,7 @@ var q:Point=<Point>p;`;
|
||||
});
|
||||
});
|
||||
|
||||
describe(`tsserver:: VersionCache simple text`, () => {
|
||||
describe(`unittests:: tsserver:: VersionCache simple text`, () => {
|
||||
let validateEditAtPosition: (position: number, deleteLength: number, insertString: string) => void;
|
||||
let testContent: string;
|
||||
let lines: string[];
|
||||
@@ -181,7 +181,7 @@ and grew 1cm per day`;
|
||||
});
|
||||
});
|
||||
|
||||
describe(`tsserver:: VersionCache stress test`, () => {
|
||||
describe(`unittests:: tsserver:: VersionCache stress test`, () => {
|
||||
let rsa: number[] = [];
|
||||
let la: number[] = [];
|
||||
let las: number[] = [];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace ts.projectSystem {
|
||||
import Tsc_WatchDirectory = TestFSWithWatch.Tsc_WatchDirectory;
|
||||
describe("tsserver:: watchEnvironment:: tsserverProjectSystem watchDirectories implementation", () => {
|
||||
describe("unittests:: tsserver:: watchEnvironment:: tsserverProjectSystem watchDirectories implementation", () => {
|
||||
function verifyCompletionListWithNewFileInSubFolder(tscWatchDirectory: Tsc_WatchDirectory) {
|
||||
const projectFolder = "/a/username/project";
|
||||
const projectSrcFolder = `${projectFolder}/src`;
|
||||
@@ -83,7 +83,7 @@ namespace ts.projectSystem {
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsserver:: watchEnvironment:: tsserverProjectSystem Watched recursive directories with windows style file system", () => {
|
||||
describe("unittests:: tsserver:: watchEnvironment:: tsserverProjectSystem Watched recursive directories with windows style file system", () => {
|
||||
function verifyWatchedDirectories(rootedPath: string, useProjectAtRoot: boolean) {
|
||||
const root = useProjectAtRoot ? rootedPath : `${rootedPath}myfolder/allproject/`;
|
||||
const configFile: File = {
|
||||
|
||||
Reference in New Issue
Block a user