Skip to content

Commit 1ed67c0

Browse files
committed
Accept test changes
1 parent fa7f5cb commit 1ed67c0

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/testRunner/unittests/textStorage.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ namespace ts.textStorage {
1010
}`
1111
};
1212

13+
function getDummyScriptInfo() {
14+
return { closeSourceMapFileWatcher: noop } as server.ScriptInfo;
15+
}
16+
1317
it("text based storage should be have exactly the same as script version cache", () => {
1418

1519
const host = projectSystem.createServerHost([f]);
1620
// Since script info is not used in these tests, just cheat by passing undefined
17-
const ts1 = new server.TextStorage(host, server.asNormalizedPath(f.path), /*initialVersion*/ undefined, {} as server.ScriptInfo);
18-
const ts2 = new server.TextStorage(host, server.asNormalizedPath(f.path), /*initialVersion*/ undefined, {} as server.ScriptInfo);
21+
const ts1 = new server.TextStorage(host, server.asNormalizedPath(f.path), /*initialVersion*/ undefined, getDummyScriptInfo());
22+
const ts2 = new server.TextStorage(host, server.asNormalizedPath(f.path), /*initialVersion*/ undefined, getDummyScriptInfo());
1923

2024
ts1.useScriptVersionCache_TestOnly();
2125
ts2.useText();
@@ -49,7 +53,7 @@ namespace ts.textStorage {
4953
it("should switch to script version cache if necessary", () => {
5054
const host = projectSystem.createServerHost([f]);
5155
// Since script info is not used in these tests, just cheat by passing undefined
52-
const ts1 = new server.TextStorage(host, server.asNormalizedPath(f.path), /*initialVersion*/ undefined, {} as server.ScriptInfo);
56+
const ts1 = new server.TextStorage(host, server.asNormalizedPath(f.path), /*initialVersion*/ undefined, getDummyScriptInfo());
5357

5458
ts1.getSnapshot();
5559
assert.isFalse(ts1.hasScriptVersionCache_TestOnly(), "should not have script version cache - 1");
@@ -67,15 +71,15 @@ namespace ts.textStorage {
6771
it("should be able to return the file size immediately after construction", () => {
6872
const host = projectSystem.createServerHost([f]);
6973
// Since script info is not used in these tests, just cheat by passing undefined
70-
const ts1 = new server.TextStorage(host, server.asNormalizedPath(f.path), /*initialVersion*/ undefined, {} as server.ScriptInfo);
74+
const ts1 = new server.TextStorage(host, server.asNormalizedPath(f.path), /*initialVersion*/ undefined, getDummyScriptInfo());
7175

7276
assert.strictEqual(f.content.length, ts1.getTelemetryFileSize());
7377
});
7478

7579
it("should be able to return the file size when backed by text", () => {
7680
const host = projectSystem.createServerHost([f]);
7781
// Since script info is not used in these tests, just cheat by passing undefined
78-
const ts1 = new server.TextStorage(host, server.asNormalizedPath(f.path), /*initialVersion*/ undefined, {} as server.ScriptInfo);
82+
const ts1 = new server.TextStorage(host, server.asNormalizedPath(f.path), /*initialVersion*/ undefined, getDummyScriptInfo());
7983

8084
ts1.useText(f.content);
8185
assert.isFalse(ts1.hasScriptVersionCache_TestOnly());
@@ -86,7 +90,7 @@ namespace ts.textStorage {
8690
it("should be able to return the file size when backed by a script version cache", () => {
8791
const host = projectSystem.createServerHost([f]);
8892
// Since script info is not used in these tests, just cheat by passing undefined
89-
const ts1 = new server.TextStorage(host, server.asNormalizedPath(f.path), /*initialVersion*/ undefined, {} as server.ScriptInfo);
93+
const ts1 = new server.TextStorage(host, server.asNormalizedPath(f.path), /*initialVersion*/ undefined, getDummyScriptInfo());
9094

9195
ts1.useScriptVersionCache_TestOnly();
9296
assert.isTrue(ts1.hasScriptVersionCache_TestOnly());
@@ -126,7 +130,7 @@ namespace ts.textStorage {
126130

127131
const host = projectSystem.createServerHost([changingFile]);
128132
// Since script info is not used in these tests, just cheat by passing undefined
129-
const ts1 = new server.TextStorage(host, server.asNormalizedPath(changingFile.path), /*initialVersion*/ undefined, {} as server.ScriptInfo);
133+
const ts1 = new server.TextStorage(host, server.asNormalizedPath(changingFile.path), /*initialVersion*/ undefined, getDummyScriptInfo());
130134

131135
assert.isTrue(ts1.reloadFromDisk());
132136

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8688,6 +8688,8 @@ declare namespace ts.server {
86888688
*/
86898689
getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo | undefined;
86908690
getScriptInfoForPath(fileName: Path): ScriptInfo | undefined;
8691+
private addSourceInfoToSourceMap;
8692+
private addMissingSourceMapFile;
86918693
setHostConfiguration(args: protocol.ConfigureRequestArguments): void;
86928694
closeLog(): void;
86938695
/**

0 commit comments

Comments
 (0)