mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 11:24:49 -05:00
Add name of test in all describe blocks in it
This commit is contained in:
@@ -68,8 +68,7 @@
|
||||
"unittests/parsePseudoBigInt.ts",
|
||||
"unittests/paths.ts",
|
||||
"unittests/printer.ts",
|
||||
"unittests/programMissingFiles.ts",
|
||||
"unittests/programNoParseFalsyFileNames.ts",
|
||||
"unittests/programApi.ts",
|
||||
"unittests/projectErrors.ts",
|
||||
"unittests/projectReferences.ts",
|
||||
"unittests/publicApi.ts",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("parseCommandLine", () => {
|
||||
describe("commandLineParsing:: parseCommandLine", () => {
|
||||
|
||||
function assertParseResult(commandLine: string[], expectedParsedCommandLine: ParsedCommandLine) {
|
||||
const parsed = parseCommandLine(commandLine);
|
||||
@@ -367,7 +367,7 @@ namespace ts {
|
||||
});
|
||||
});
|
||||
|
||||
describe("parseBuildOptions", () => {
|
||||
describe("commandLineParsing:: parseBuildOptions", () => {
|
||||
function assertParseResult(commandLine: string[], expectedParsedBuildCommand: ParsedBuildCommand) {
|
||||
const parsed = parseBuildCommand(commandLine);
|
||||
const parsedBuildOptions = JSON.stringify(parsed.buildOptions);
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace ts.projectSystem {
|
||||
return new TestTypingsInstaller("/a/data/", /*throttleLimit*/5, host);
|
||||
}
|
||||
|
||||
describe("CompileOnSave affected list", () => {
|
||||
describe("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));
|
||||
@@ -504,7 +504,7 @@ namespace ts.projectSystem {
|
||||
});
|
||||
});
|
||||
|
||||
describe("EmitFile test", () => {
|
||||
describe("compileOnSave:: EmitFile test", () => {
|
||||
it("should respect line endings", () => {
|
||||
test("\n");
|
||||
test("\r\n");
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
describe("Node module resolution - relative paths", () => {
|
||||
describe("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("Node module resolution - non-relative paths", () => {
|
||||
describe("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("Module resolution - relative imports", () => {
|
||||
describe("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("Files with different casing", () => {
|
||||
describe("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("baseUrl augmented module resolution", () => {
|
||||
describe("moduleResolution:: baseUrl augmented module resolution", () => {
|
||||
|
||||
it("module resolution without path mappings/rootDirs", () => {
|
||||
test(/*hasDirectoryExists*/ false);
|
||||
@@ -1098,7 +1098,7 @@ import b = require("./moduleB");
|
||||
});
|
||||
});
|
||||
|
||||
describe("ModuleResolutionHost.directoryExists", () => {
|
||||
describe("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("Type reference directive resolution: ", () => {
|
||||
describe("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);
|
||||
|
||||
@@ -97,6 +97,34 @@ namespace ts {
|
||||
"d:/pretend/nonexistent4.tsx"
|
||||
]);
|
||||
});
|
||||
|
||||
it("should not have missing file paths", () => {
|
||||
const testSource = `
|
||||
class Foo extends HTMLElement {
|
||||
bar: string = 'baz';
|
||||
}`;
|
||||
|
||||
const host: CompilerHost = {
|
||||
getSourceFile: (fileName: string, languageVersion: ScriptTarget, _onError?: (message: string) => void) => {
|
||||
return fileName === "test.ts" ? createSourceFile(fileName, testSource, languageVersion) : undefined;
|
||||
},
|
||||
getDefaultLibFileName: () => "",
|
||||
writeFile: (_fileName, _content) => { throw new Error("unsupported"); },
|
||||
getCurrentDirectory: () => sys.getCurrentDirectory(),
|
||||
getCanonicalFileName: fileName => sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(),
|
||||
getNewLine: () => sys.newLine,
|
||||
useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames,
|
||||
fileExists: fileName => fileName === "test.ts",
|
||||
readFile: fileName => fileName === "test.ts" ? testSource : undefined,
|
||||
resolveModuleNames: (_moduleNames: string[], _containingFile: string) => { throw new Error("unsupported"); },
|
||||
getDirectories: _path => { throw new Error("unsupported"); },
|
||||
};
|
||||
|
||||
const program = createProgram(["test.ts"], { module: ModuleKind.ES2015 }, host);
|
||||
assert(program.getSourceFiles().length === 1, "expected 'getSourceFiles' length to be 1");
|
||||
assert(program.getMissingFilePaths().length === 0, "expected 'getMissingFilePaths' length to be 0");
|
||||
assert(program.getFileProcessingDiagnostics().getDiagnostics().length === 0, "expected 'getFileProcessingDiagnostics' length to be 0");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Program.isSourceFileFromExternalLibrary", () => {
|
||||
@@ -1,36 +0,0 @@
|
||||
namespace ts {
|
||||
describe("programNoParseFalsyFileNames", () => {
|
||||
let program: Program;
|
||||
|
||||
beforeEach(() => {
|
||||
const testSource = `
|
||||
class Foo extends HTMLElement {
|
||||
bar: string = 'baz';
|
||||
}`;
|
||||
|
||||
const host: CompilerHost = {
|
||||
getSourceFile: (fileName: string, languageVersion: ScriptTarget, _onError?: (message: string) => void) => {
|
||||
return fileName === "test.ts" ? createSourceFile(fileName, testSource, languageVersion) : undefined;
|
||||
},
|
||||
getDefaultLibFileName: () => "",
|
||||
writeFile: (_fileName, _content) => { throw new Error("unsupported"); },
|
||||
getCurrentDirectory: () => sys.getCurrentDirectory(),
|
||||
getCanonicalFileName: fileName => sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(),
|
||||
getNewLine: () => sys.newLine,
|
||||
useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames,
|
||||
fileExists: fileName => fileName === "test.ts",
|
||||
readFile: fileName => fileName === "test.ts" ? testSource : undefined,
|
||||
resolveModuleNames: (_moduleNames: string[], _containingFile: string) => { throw new Error("unsupported"); },
|
||||
getDirectories: _path => { throw new Error("unsupported"); },
|
||||
};
|
||||
|
||||
program = createProgram(["test.ts"], { module: ModuleKind.ES2015 }, host);
|
||||
});
|
||||
|
||||
it("should not have missing file paths", () => {
|
||||
assert(program.getSourceFiles().length === 1, "expected 'getSourceFiles' length to be 1");
|
||||
assert(program.getMissingFilePaths().length === 0, "expected 'getMissingFilePaths' length to be 0");
|
||||
assert(program.getFileProcessingDiagnostics().getDiagnostics().length === 0, "expected 'getFileProcessingDiagnostics' length to be 0");
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts.projectSystem {
|
||||
describe("Project errors", () => {
|
||||
describe("tsserver:: Project Errors", () => {
|
||||
function checkProjectErrors(projectFiles: server.ProjectFilesWithTSDiagnostics, expectedErrors: ReadonlyArray<string>): void {
|
||||
assert.isTrue(projectFiles !== undefined, "missing project files");
|
||||
checkProjectErrorsWorker(projectFiles.projectErrors, expectedErrors);
|
||||
|
||||
@@ -308,7 +308,7 @@ namespace ts {
|
||||
});
|
||||
});
|
||||
|
||||
describe("errors when a file in a composite project occurs outside the root", () => {
|
||||
describe("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": {
|
||||
|
||||
@@ -210,7 +210,7 @@ namespace ts {
|
||||
checkCache("resolved type directives", program, fileName, expectedContent, f => f.resolvedTypeReferenceDirectiveNames, checkResolvedTypeDirective);
|
||||
}
|
||||
|
||||
describe("Reuse program structure", () => {
|
||||
describe("Reuse program structure:: General", () => {
|
||||
const target = ScriptTarget.Latest;
|
||||
const files: NamedSourceText[] = [
|
||||
{
|
||||
@@ -895,7 +895,7 @@ namespace ts {
|
||||
});
|
||||
});
|
||||
|
||||
describe("host is optional", () => {
|
||||
describe("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("isProgramUptoDate should return true when there is no change in compiler options and", () => {
|
||||
describe("Reuse program structure:: isProgramUptoDate should return true when there is no change in compiler options and", () => {
|
||||
function verifyProgramIsUptoDate(
|
||||
program: Program,
|
||||
newRootFileNames: string[],
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
describe("the Session class", () => {
|
||||
describe("tsserver:: Session:: General functionality", () => {
|
||||
let session: TestSession;
|
||||
let lastSent: protocol.Message;
|
||||
|
||||
@@ -418,7 +418,7 @@ namespace ts.server {
|
||||
});
|
||||
});
|
||||
|
||||
describe("exceptions", () => {
|
||||
describe("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("how Session is extendable via subclassing", () => {
|
||||
describe("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("an example of using the Session API to create an in-process server", () => {
|
||||
describe("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("helpers", () => {
|
||||
describe("tsserver:: Session:: helpers", () => {
|
||||
it(getLocationInNewDocument.name, () => {
|
||||
const text = `// blank line\nconst x = 0;`;
|
||||
const renameLocationInOldText = text.indexOf("0");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace ts {
|
||||
describe("parseConfigFileTextToJson", () => {
|
||||
describe("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));
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user