Home / File/ caching.test.ts — astro Source File

caching.test.ts — astro Source File

Architecture documentation for caching.test.ts, a typescript file in the astro codebase. 9 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  e7816cc0_2cb2_78e0_7913_a132534e0e56["caching.test.ts"]
  923db4e1_01a0_98ab_9c38_dfe16dd4bada["server.ts"]
  e7816cc0_2cb2_78e0_7913_a132534e0e56 --> 923db4e1_01a0_98ab_9c38_dfe16dd4bada
  9cf7acc9_e2e5_26e3_64f0_7304d1983c86["getLanguageServer"]
  e7816cc0_2cb2_78e0_7913_a132534e0e56 --> 9cf7acc9_e2e5_26e3_64f0_7304d1983c86
  d8206fa8_f041_14e6_d043_1fc32953407c["utils.ts"]
  e7816cc0_2cb2_78e0_7913_a132534e0e56 --> d8206fa8_f041_14e6_d043_1fc32953407c
  db323e8c_04ef_9777_0487_224de5819a30["node:assert"]
  e7816cc0_2cb2_78e0_7913_a132534e0e56 --> db323e8c_04ef_9777_0487_224de5819a30
  5d6d1861_a18d_b246_cd94_08889ab7e74c["promises"]
  e7816cc0_2cb2_78e0_7913_a132534e0e56 --> 5d6d1861_a18d_b246_cd94_08889ab7e74c
  c52a5f83_66e3_37d7_9ebb_767f7129bc62["node:path"]
  e7816cc0_2cb2_78e0_7913_a132534e0e56 --> c52a5f83_66e3_37d7_9ebb_767f7129bc62
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  e7816cc0_2cb2_78e0_7913_a132534e0e56 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  6857b6b2_4d48_bfb0_0a0e_8e2e52fabb56["language-server"]
  e7816cc0_2cb2_78e0_7913_a132534e0e56 --> 6857b6b2_4d48_bfb0_0a0e_8e2e52fabb56
  abeb339e_cdba_0d7f_6b7f_3696c1eb86f9["vscode-uri"]
  e7816cc0_2cb2_78e0_7913_a132534e0e56 --> abeb339e_cdba_0d7f_6b7f_3696c1eb86f9
  style e7816cc0_2cb2_78e0_7913_a132534e0e56 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import assert from 'node:assert';
import { mkdir, readdir, rm, writeFile } from 'node:fs/promises';
import path from 'node:path';
import { after, before, describe, it } from 'node:test';
import {
	FileChangeType,
	type FullDocumentDiagnosticReport,
	type MarkupContent,
} from '@volar/language-server';
import { URI } from 'vscode-uri';
import { getLanguageServer, type LanguageServer } from '../server.ts';
import { fixtureDir } from '../utils.ts';

describe('TypeScript - Cache invalidation', async () => {
	let languageServer: LanguageServer;

	async function createFile(name: string, contents: string) {
		const filePath = path.join(fixtureDir, 'caching', name);
		const fileURI = URI.file(filePath).toString();
		await writeFile(filePath, '');
		await languageServer.handle.didChangeWatchedFiles([
			{
				uri: fileURI,
				type: FileChangeType.Created,
			},
		]);
		const openedDocument = await languageServer.handle.openTextDocument(filePath, 'astro');
		await languageServer.handle.updateTextDocument(fileURI, [
			{
				newText: contents,
				range: {
					start: { line: 0, character: 0 },
					end: { line: 0, character: 0 },
				},
			},
		]);

		return openedDocument;
	}

	async function removeFile(name: string) {
		const fileURI = URI.file(path.join(fixtureDir, 'caching', name)).toString();
		await rm(path.join(fixtureDir, 'caching', name));
		await languageServer.handle.didChangeWatchedFiles([
			{
				uri: fileURI,
				type: FileChangeType.Deleted,
			},
		]);
	}

	before(async () => {
		languageServer = await getLanguageServer();

		try {
			await mkdir(path.join(fixtureDir, 'caching'));
		} catch {}

		await createFile('toBeDeleted.astro', '');
	});
// ... (125 more lines)

Domain

Dependencies

Frequently Asked Questions

What does caching.test.ts do?
caching.test.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain.
What does caching.test.ts depend on?
caching.test.ts imports 9 module(s): getLanguageServer, language-server, node:assert, node:path, node:test, promises, server.ts, utils.ts, and 1 more.
Where is caching.test.ts in the architecture?
caching.test.ts is located at packages/language-tools/language-server/test/typescript/caching.test.ts (domain: CoreAstro, directory: packages/language-tools/language-server/test/typescript).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free