Skip to content

Commit

Permalink
Fix/restore a few caching tests (#881)
Browse files Browse the repository at this point in the history
* Fix/restore a few caching tests

* test: fixes tests

* chore: remove test files

---------

Co-authored-by: Princesseuh <3019731+Princesseuh@users.noreply.github.com>
  • Loading branch information
machty and Princesseuh authored Jul 8, 2024
1 parent 829093f commit d7b38c4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions packages/language-server/test/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ export async function getLanguageServer(): Promise<LanguageServer> {
),
},
pullModelDiagnostics: true,
},
{
workspace: {
// Needed for tests that use didChangeWatchedFiles
didChangeWatchedFiles: {},
},
}
);
// Ensure that our first test does not suffer from a TypeScript overhead
Expand Down
12 changes: 6 additions & 6 deletions packages/language-server/test/typescript/caching.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import { type LanguageServer, getLanguageServer } from '../server.js';

const fixtureDir = path.join(__dirname, '../fixture');

// TODO: Skipping this suite for now, I can't seems to be able to replicate the notifications being sent correctly, not sure if it's a bug in the test or in Volar
describe.skip('TypeScript - Cache invalidation', async () => {
describe('TypeScript - Cache invalidation', async () => {
let languageServer: LanguageServer;

async function createFile(name: string, contents: string) {
Expand Down Expand Up @@ -106,15 +105,16 @@ describe.skip('TypeScript - Cache invalidation', async () => {
);
});

it('Can get auto-imports for new files', async () => {
// TODO: Unskip this once the upstream issue is fixed
it.skip('Can get auto-imports for new files', async () => {
const fileNames = ['AutoImport.astro', 'AutoImport2.astro'];

const document = await languageServer.handle.openTextDocument(
path.join(fixtureDir, 'cachingTest.astro'),
'astro'
);

// Try two different files, to make sure the cache capture everything
// Try two different files in a row, to make sure the cache updates properly for each file individually
for (const fileName of fileNames) {
await createFile(fileName, '');

Expand Down Expand Up @@ -159,8 +159,8 @@ describe.skip('TypeScript - Cache invalidation', async () => {
);

const hoverSuperModule = await languageServer.handle.sendHoverRequest(document.uri, {
line: 1,
character: 25,
line: 2,
character: 22,
});

expect((hoverSuperModule?.contents as MarkupContent).value).to.include(
Expand Down

0 comments on commit d7b38c4

Please sign in to comment.