Home / File/ test.ts — svelte Source File

test.ts — svelte Source File

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

File typescript BuildSystem 7 imports 18 dependents

Entity Profile

Dependency Diagram

graph LR
  114bc14b_6a0c_6e74_902b_1d994769457f["test.ts"]
  e97e8c41_1b06_4e9a_29f3_64dbb37dee3c["helpers.js"]
  114bc14b_6a0c_6e74_902b_1d994769457f --> e97e8c41_1b06_4e9a_29f3_64dbb37dee3c
  40a894df_04e7_906d_8c12_9e2e7b588e57["compile_directory"]
  114bc14b_6a0c_6e74_902b_1d994769457f --> 40a894df_04e7_906d_8c12_9e2e7b588e57
  b2df78f1_f7aa_6fef_0a5c_4dcf959880ff["../suite.js"]
  114bc14b_6a0c_6e74_902b_1d994769457f --> b2df78f1_f7aa_6fef_0a5c_4dcf959880ff
  f596e027_a951_36c9_7695_83acc4f0d6b9["node:fs"]
  114bc14b_6a0c_6e74_902b_1d994769457f --> f596e027_a951_36c9_7695_83acc4f0d6b9
  b63ddb92_634c_990b_eb1b_0bad8a4d434e["vitest"]
  114bc14b_6a0c_6e74_902b_1d994769457f --> b63ddb92_634c_990b_eb1b_0bad8a4d434e
  2db0e77d_ac2f_3ebe_a623_89635ba685ad["tinyglobby"]
  114bc14b_6a0c_6e74_902b_1d994769457f --> 2db0e77d_ac2f_3ebe_a623_89635ba685ad
  a8d49317_f479_a216_78e7_48c9e32499d5["compiler"]
  114bc14b_6a0c_6e74_902b_1d994769457f --> a8d49317_f479_a216_78e7_48c9e32499d5
  25beba35_99ca_73c1_3f94_87aba3cef752["_config.js"]
  25beba35_99ca_73c1_3f94_87aba3cef752 --> 114bc14b_6a0c_6e74_902b_1d994769457f
  07439f15_8cef_72c3_0b67_8e62f51796f5["_config.js"]
  07439f15_8cef_72c3_0b67_8e62f51796f5 --> 114bc14b_6a0c_6e74_902b_1d994769457f
  adcb24c5_2942_9fef_d934_c50dba555f61["_config.js"]
  adcb24c5_2942_9fef_d934_c50dba555f61 --> 114bc14b_6a0c_6e74_902b_1d994769457f
  b8c9c242_d2c2_7b60_fcb6_5e9cfa68eff1["_config.js"]
  b8c9c242_d2c2_7b60_fcb6_5e9cfa68eff1 --> 114bc14b_6a0c_6e74_902b_1d994769457f
  d7fbf783_0de8_1731_70c4_010a5bbf7c35["_config.js"]
  d7fbf783_0de8_1731_70c4_010a5bbf7c35 --> 114bc14b_6a0c_6e74_902b_1d994769457f
  3dfcd5c0_af33_90c9_f2c7_6c4e19e7b857["_config.js"]
  3dfcd5c0_af33_90c9_f2c7_6c4e19e7b857 --> 114bc14b_6a0c_6e74_902b_1d994769457f
  0ae18609_e1b1_68c0_7864_7d1369e1f0b6["_config.js"]
  0ae18609_e1b1_68c0_7864_7d1369e1f0b6 --> 114bc14b_6a0c_6e74_902b_1d994769457f
  style 114bc14b_6a0c_6e74_902b_1d994769457f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as fs from 'node:fs';
import { assert, expect } from 'vitest';
import { globSync } from 'tinyglobby';
import { compile_directory } from '../helpers.js';
import { suite, type BaseTest } from '../suite.js';
import { VERSION } from 'svelte/compiler';

interface SnapshotTest extends BaseTest {
	compileOptions?: Partial<import('#compiler').CompileOptions>;
}

const { test, run } = suite<SnapshotTest>(async (config, cwd) => {
	await compile_directory(cwd, 'client', config.compileOptions);
	await compile_directory(cwd, 'server', config.compileOptions);

	// run `UPDATE_SNAPSHOTS=true pnpm test snapshot` to update snapshot tests
	if (process.env.UPDATE_SNAPSHOTS) {
		fs.rmSync(`${cwd}/_expected`, { recursive: true, force: true });
		fs.cpSync(`${cwd}/_output`, `${cwd}/_expected`, { recursive: true, force: true });
	} else {
		const actual = globSync('**', { cwd: `${cwd}/_output`, onlyFiles: true });
		const expected = globSync('**', { cwd: `${cwd}/_expected`, onlyFiles: true });

		assert.deepEqual(actual, expected);

		for (const file of actual) {
			const actual_content = fs
				.readFileSync(`${cwd}/_output/${file}`, 'utf-8')
				.replaceAll('\r\n', '\n')
				.trimEnd()
				.replace(`v${VERSION}`, 'VERSION');
			const expected_content = fs
				.readFileSync(`${cwd}/_expected/${file}`, 'utf-8')
				.replaceAll('\r\n', '\n')
				.trimEnd();

			expect(actual_content).toBe(expected_content);
		}
	}
});

export { test };

await run(__dirname);

Domain

Types

Dependencies

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 7 module(s): ../suite.js, compile_directory, compiler, helpers.js, node:fs, tinyglobby, vitest.
What files import test.ts?
test.ts is imported by 18 file(s): _config.js, _config.js, _config.js, _config.js, _config.js, _config.js, _config.js, _config.js, and 10 more.
Where is test.ts in the architecture?
test.ts is located at packages/svelte/tests/snapshot/test.ts (domain: BuildSystem, directory: packages/svelte/tests/snapshot).

Analyze Your Own Codebase

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

Try Supermodel Free