Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c02865f

Browse filesBrowse files
authored
Merge pull request microsoft#18958 from Microsoft/compilePublicApi
Compile public api so that all the updates are ensured to be correct
2 parents 8b2a219 + ee05d0e commit c02865f
Copy full SHA for c02865f

3 files changed

+31-7Lines changed: 31 additions & 7 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/harness/unittests/publicApi.ts‎

Copy file name to clipboard
+29-5Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,34 @@
11
/// <reference path="../harness.ts" />
22

33
describe("Public APIs", () => {
4-
it("for the language service and compiler should be acknowledged when they change", () => {
5-
Harness.Baseline.runBaseline("api/typescript.d.ts", () => Harness.IO.readFile("built/local/typescript.d.ts"));
4+
function verifyApi(fileName: string) {
5+
const builtFile = `built/local/${fileName}`;
6+
const api = `api/${fileName}`;
7+
let fileContent: string;
8+
before(() => {
9+
fileContent = Harness.IO.readFile(builtFile);
10+
});
11+
12+
it("should be acknowledged when they change", () => {
13+
Harness.Baseline.runBaseline(api, () => fileContent);
14+
});
15+
16+
it("should compile", () => {
17+
const testFile: Harness.Compiler.TestFile = {
18+
unitName: builtFile,
19+
content: fileContent
20+
};
21+
const inputFiles = [testFile];
22+
const output = Harness.Compiler.compileFiles(inputFiles, [], /*harnessSettings*/ undefined, /*options*/ {}, /*currentDirectory*/ undefined);
23+
assert(!output.result.errors || !output.result.errors.length, Harness.Compiler.minimalDiagnosticsToString(output.result.errors, /*pretty*/ true));
24+
});
25+
}
26+
27+
describe("for the language service and compiler", () => {
28+
verifyApi("typescript.d.ts");
629
});
7-
it("for the language server should be acknowledged when they change", () => {
8-
Harness.Baseline.runBaseline("api/tsserverlibrary.d.ts", () => Harness.IO.readFile("built/local/tsserverlibrary.d.ts"));
30+
31+
describe("for the language server", () => {
32+
verifyApi("tsserverlibrary.d.ts");
933
});
10-
});
34+
});
Collapse file

‎src/server/project.ts‎

Copy file name to clipboardExpand all lines: src/server/project.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ namespace ts.server {
296296
}
297297
}
298298

299-
getCancellationToken() {
299+
getCancellationToken(): HostCancellationToken {
300300
return this.cancellationToken;
301301
}
302302

Collapse file

‎tests/baselines/reference/api/tsserverlibrary.d.ts‎

Copy file name to clipboardExpand all lines: tests/baselines/reference/api/tsserverlibrary.d.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7104,7 +7104,7 @@ declare namespace ts.server {
71047104
getScriptKind(fileName: string): ScriptKind;
71057105
getScriptVersion(filename: string): string;
71067106
getScriptSnapshot(filename: string): IScriptSnapshot;
7107-
getCancellationToken(): ThrottledCancellationToken;
7107+
getCancellationToken(): HostCancellationToken;
71087108
getCurrentDirectory(): string;
71097109
getDefaultLibFileName(): string;
71107110
useCaseSensitiveFileNames(): boolean;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.