Skip to content

Commit

Permalink
chore: try fix flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonlyu123 committed Nov 16, 2023
1 parent d7457f4 commit 30afe40
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ describe('CompletionProviderImpl', function () {
async function openFileToBeImported(
docManager: DocumentManager,
completionProvider: CompletionsProviderImpl,
name = 'imported-file.svelte'
name = '../imported-file.svelte'
) {
const filePath = join(testFilesDir, name);
const hoverinfoDoc = docManager.openClientDocument(<any>{
Expand Down
29 changes: 29 additions & 0 deletions packages/language-server/test/plugins/typescript/service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,33 @@ describe('service', () => {
);
}
});

it('can open client file that do not exist in fs', async () => {
const dirPath = getRandomVirtualDirPath(testDir);
const { virtualSystem, lsDocumentContext, rootUris } = setup();

virtualSystem.writeFile(
path.join(dirPath, 'tsconfig.json'),
JSON.stringify({
compilerOptions: <ts.CompilerOptions>{
checkJs: true,
strict: true
}
})
);

const ls = await getService(
path.join(dirPath, 'random.svelte'),
rootUris,
lsDocumentContext
);

const document = new Document(pathToUrl(path.join(dirPath, 'random.ts')), '');
document.openedByClient = true;
ls.updateSnapshot(document);

assert.doesNotThrow(() => {
ls.getService().getSemanticDiagnostics(document.getFilePath()!);
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<script></script>

0 comments on commit 30afe40

Please sign in to comment.