mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 11:54:44 -06:00
Merge pull request #18958 from Microsoft/compilePublicApi
Compile public api so that all the updates are ensured to be correct
This commit is contained in:
commit
c02865f357
@ -1,10 +1,34 @@
|
||||
/// <reference path="../harness.ts" />
|
||||
|
||||
describe("Public APIs", () => {
|
||||
it("for the language service and compiler should be acknowledged when they change", () => {
|
||||
Harness.Baseline.runBaseline("api/typescript.d.ts", () => Harness.IO.readFile("built/local/typescript.d.ts"));
|
||||
function verifyApi(fileName: string) {
|
||||
const builtFile = `built/local/${fileName}`;
|
||||
const api = `api/${fileName}`;
|
||||
let fileContent: string;
|
||||
before(() => {
|
||||
fileContent = Harness.IO.readFile(builtFile);
|
||||
});
|
||||
|
||||
it("should be acknowledged when they change", () => {
|
||||
Harness.Baseline.runBaseline(api, () => fileContent);
|
||||
});
|
||||
|
||||
it("should compile", () => {
|
||||
const testFile: Harness.Compiler.TestFile = {
|
||||
unitName: builtFile,
|
||||
content: fileContent
|
||||
};
|
||||
const inputFiles = [testFile];
|
||||
const output = Harness.Compiler.compileFiles(inputFiles, [], /*harnessSettings*/ undefined, /*options*/ {}, /*currentDirectory*/ undefined);
|
||||
assert(!output.result.errors || !output.result.errors.length, Harness.Compiler.minimalDiagnosticsToString(output.result.errors, /*pretty*/ true));
|
||||
});
|
||||
}
|
||||
|
||||
describe("for the language service and compiler", () => {
|
||||
verifyApi("typescript.d.ts");
|
||||
});
|
||||
it("for the language server should be acknowledged when they change", () => {
|
||||
Harness.Baseline.runBaseline("api/tsserverlibrary.d.ts", () => Harness.IO.readFile("built/local/tsserverlibrary.d.ts"));
|
||||
|
||||
describe("for the language server", () => {
|
||||
verifyApi("tsserverlibrary.d.ts");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -296,7 +296,7 @@ namespace ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
getCancellationToken() {
|
||||
getCancellationToken(): HostCancellationToken {
|
||||
return this.cancellationToken;
|
||||
}
|
||||
|
||||
|
||||
@ -7104,7 +7104,7 @@ declare namespace ts.server {
|
||||
getScriptKind(fileName: string): ScriptKind;
|
||||
getScriptVersion(filename: string): string;
|
||||
getScriptSnapshot(filename: string): IScriptSnapshot;
|
||||
getCancellationToken(): ThrottledCancellationToken;
|
||||
getCancellationToken(): HostCancellationToken;
|
||||
getCurrentDirectory(): string;
|
||||
getDefaultLibFileName(): string;
|
||||
useCaseSensitiveFileNames(): boolean;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user