Skip to content

Commit c5089cf

Browse files
committed
fix: Fix tests
1 parent 30b2a1f commit c5089cf

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

browserMock.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,11 @@ Object.defineProperty(window, 'ResizeObserver', {
4949
constructor(stringUrl) {}
5050
observe() {}
5151
}
52+
})
53+
54+
Object.defineProperty(window, 'TextEncoder', {
55+
value: class TextObserver {
56+
constructor(stringUrl) {}
57+
encode(src) { return src }
58+
}
5259
})

src/tests/tools.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ import {
88
} from 'vscode-languageserver/lib/common/api'
99
import { monaco } from '@codingame/monaco-editor-wrapper'
1010
import { MessageTransports } from 'monaco-languageclient'
11+
import * as vscode from 'vscode'
1112
import { getFile, updateFile } from '../customRequests'
12-
import { Infrastructure, LanguageClientId, LanguageClientManager, LanguageClientOptions, TextDocument, TextDocumentSaveReason } from '../'
13+
import { Infrastructure, LanguageClientId, LanguageClientManager, LanguageClientOptions } from '../'
1314

1415
class PipedMessageReader extends AbstractMessageReader {
1516
private callback: DataCallback | undefined
@@ -141,7 +142,7 @@ export class TestInfrastructure implements Infrastructure {
141142
}
142143

143144
// use same method as CodinGameInfrastructure to be able to simply catch it
144-
public async saveFileContent (document: TextDocument, reason: TextDocumentSaveReason, languageClient: LanguageClientManager): Promise<void> {
145+
public async saveFileContent (document: vscode.TextDocument, reason: vscode.TextDocumentSaveReason, languageClient: LanguageClientManager): Promise<void> {
145146
if (languageClient.isConnected()) {
146147
await updateFile(document.uri.toString(), document.getText(), languageClient)
147148
}

0 commit comments

Comments
 (0)