Home / File/ test.ts — svelte Source File

test.ts — svelte Source File

Architecture documentation for test.ts, a typescript file in the svelte codebase. 4 imports, 19 dependents.

File typescript BuildSystem 4 imports 19 dependents

Entity Profile

Dependency Diagram

graph LR
  fc06c886_51db_d0d2_6501_4080bb86736e["test.ts"]
  b2df78f1_f7aa_6fef_0a5c_4dcf959880ff["../suite.js"]
  fc06c886_51db_d0d2_6501_4080bb86736e --> b2df78f1_f7aa_6fef_0a5c_4dcf959880ff
  f596e027_a951_36c9_7695_83acc4f0d6b9["node:fs"]
  fc06c886_51db_d0d2_6501_4080bb86736e --> f596e027_a951_36c9_7695_83acc4f0d6b9
  a8d49317_f479_a216_78e7_48c9e32499d5["compiler"]
  fc06c886_51db_d0d2_6501_4080bb86736e --> a8d49317_f479_a216_78e7_48c9e32499d5
  b63ddb92_634c_990b_eb1b_0bad8a4d434e["vitest"]
  fc06c886_51db_d0d2_6501_4080bb86736e --> b63ddb92_634c_990b_eb1b_0bad8a4d434e
  0e2df180_7383_6dee_c2f6_7cd068f5249a["_config.js"]
  0e2df180_7383_6dee_c2f6_7cd068f5249a --> fc06c886_51db_d0d2_6501_4080bb86736e
  d7181d89_0abd_cafd_dc03_336e7abae8dc["_config.js"]
  d7181d89_0abd_cafd_dc03_336e7abae8dc --> fc06c886_51db_d0d2_6501_4080bb86736e
  8e7fe0bc_254d_7d83_889b_f11f938175a3["_config.js"]
  8e7fe0bc_254d_7d83_889b_f11f938175a3 --> fc06c886_51db_d0d2_6501_4080bb86736e
  8181c1e2_4424_177d_da2b_2012e96101af["_config.js"]
  8181c1e2_4424_177d_da2b_2012e96101af --> fc06c886_51db_d0d2_6501_4080bb86736e
  278471e3_048d_3231_1bb6_4ded39c728bc["_config.js"]
  278471e3_048d_3231_1bb6_4ded39c728bc --> fc06c886_51db_d0d2_6501_4080bb86736e
  2e8fdd59_ebee_a406_5d0c_b7c155dc3a42["_config.js"]
  2e8fdd59_ebee_a406_5d0c_b7c155dc3a42 --> fc06c886_51db_d0d2_6501_4080bb86736e
  5cfa2aeb_f5a8_def1_3d66_fc7eec418002["_config.js"]
  5cfa2aeb_f5a8_def1_3d66_fc7eec418002 --> fc06c886_51db_d0d2_6501_4080bb86736e
  01a62e6c_610a_efbf_a05f_f57a9f95e070["_config.js"]
  01a62e6c_610a_efbf_a05f_f57a9f95e070 --> fc06c886_51db_d0d2_6501_4080bb86736e
  607cbc63_62c4_05ac_7331_f11a40adf100["_config.js"]
  607cbc63_62c4_05ac_7331_f11a40adf100 --> fc06c886_51db_d0d2_6501_4080bb86736e
  7d53743e_3606_885c_5f72_33a1bf7681b0["_config.js"]
  7d53743e_3606_885c_5f72_33a1bf7681b0 --> fc06c886_51db_d0d2_6501_4080bb86736e
  style fc06c886_51db_d0d2_6501_4080bb86736e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as fs from 'node:fs';
import { preprocess } from 'svelte/compiler';
import { expect } from 'vitest';
import { suite, type BaseTest } from '../suite.js';

interface PreprocessTest extends BaseTest {
	options?: { filename: string };
	preprocess:
		| import('svelte/compiler').PreprocessorGroup
		| import('svelte/compiler').PreprocessorGroup[];
	dependencies?: string[];
}

const { test, run } = suite<PreprocessTest>(async (config, cwd) => {
	const input = fs.readFileSync(`${cwd}/input.svelte`, 'utf-8').replace(/\r\n/g, '\n');

	const result = await preprocess(
		input,
		config.preprocess || {},
		config.options || { filename: 'input.svelte' }
	);
	fs.writeFileSync(`${cwd}/_actual.html`, result.code);

	if (result.map) {
		fs.writeFileSync(`${cwd}/_actual.html.map`, JSON.stringify(result.map, null, 2));
	}

	await expect(result.code).toMatchFileSnapshot(`${cwd}/output.svelte`);

	expect(result.dependencies).toEqual(config.dependencies || []);

	if (fs.existsSync(`${cwd}/expected_map.json`)) {
		delete (result.map as any).ignoreList;
		const expected_map = JSON.parse(fs.readFileSync(`${cwd}/expected_map.json`, 'utf-8'));
		// You can use https://sokra.github.io/source-map-visualization/#custom to visualize the source map
		expect(JSON.parse(JSON.stringify(result.map))).toEqual(expected_map);
	}
});

export { test };

await run(__dirname);

Domain

Dependencies

  • ../suite.js
  • compiler
  • node:fs
  • vitest

Frequently Asked Questions

What does test.ts do?
test.ts is a source file in the svelte codebase, written in typescript. It belongs to the BuildSystem domain.
What does test.ts depend on?
test.ts imports 4 module(s): ../suite.js, compiler, node:fs, vitest.
What files import test.ts?
test.ts is imported by 19 file(s): _config.js, _config.js, _config.js, _config.js, _config.js, _config.js, _config.js, _config.js, and 11 more.
Where is test.ts in the architecture?
test.ts is located at packages/svelte/tests/preprocess/test.ts (domain: BuildSystem, directory: packages/svelte/tests/preprocess).

Analyze Your Own Codebase

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

Try Supermodel Free