test-ssr.ts — svelte Source File
Architecture documentation for test-ssr.ts, a typescript file in the svelte codebase. 11 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 42f0f097_4458_875b_c920_692659ecc7f1["test-ssr.ts"] e97e8c41_1b06_4e9a_29f3_64dbb37dee3c["helpers.js"] 42f0f097_4458_875b_c920_692659ecc7f1 --> e97e8c41_1b06_4e9a_29f3_64dbb37dee3c 40a894df_04e7_906d_8c12_9e2e7b588e57["compile_directory"] 42f0f097_4458_875b_c920_692659ecc7f1 --> 40a894df_04e7_906d_8c12_9e2e7b588e57 7e13368c_af2f_099c_e7e1_de404629548f["html_equal.js"] 42f0f097_4458_875b_c920_692659ecc7f1 --> 7e13368c_af2f_099c_e7e1_de404629548f 1c541d89_49ad_09df_1b04_218f8bcb99e8["assert_html_equal_with_options"] 42f0f097_4458_875b_c920_692659ecc7f1 --> 1c541d89_49ad_09df_1b04_218f8bcb99e8 2b655554_f9cf_daf9_c56b_a99baafbe0fd["suite.ts"] 42f0f097_4458_875b_c920_692659ecc7f1 --> 2b655554_f9cf_daf9_c56b_a99baafbe0fd 1354ddff_1efb_c4e4_5cd0_7b354ba0a9b4["suite"] 42f0f097_4458_875b_c920_692659ecc7f1 --> 1354ddff_1efb_c4e4_5cd0_7b354ba0a9b4 f596e027_a951_36c9_7695_83acc4f0d6b9["node:fs"] 42f0f097_4458_875b_c920_692659ecc7f1 --> f596e027_a951_36c9_7695_83acc4f0d6b9 f8929fbd_6327_2bb8_f43b_31a3db2e4d74["node:path"] 42f0f097_4458_875b_c920_692659ecc7f1 --> f8929fbd_6327_2bb8_f43b_31a3db2e4d74 a9500014_cd8e_60cf_ba5b_777e383da035["promises"] 42f0f097_4458_875b_c920_692659ecc7f1 --> a9500014_cd8e_60cf_ba5b_777e383da035 19c4395f_f4bb_853e_9c49_a71d8228542e["server"] 42f0f097_4458_875b_c920_692659ecc7f1 --> 19c4395f_f4bb_853e_9c49_a71d8228542e b63ddb92_634c_990b_eb1b_0bad8a4d434e["vitest"] 42f0f097_4458_875b_c920_692659ecc7f1 --> b63ddb92_634c_990b_eb1b_0bad8a4d434e style 42f0f097_4458_875b_c920_692659ecc7f1 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// @vitest-environment jsdom
// Yes it's an SSR test, but we need the env to compare html
// This is in its own file because if we had the jsdom environment for the other playwright browser tests,
// esbuild would choke on it
import * as fs from 'node:fs';
import * as path from 'node:path';
import { setImmediate } from 'node:timers/promises';
import { render } from 'svelte/server';
import { compile_directory } from '../helpers';
import { assert_html_equal_with_options } from '../html_equal';
import { suite } from '../suite';
import { describe } from 'vitest';
export async function run_ssr_test(
config: ReturnType<typeof import('./assert').test>,
test_dir: string
) {
try {
await compile_directory(test_dir, 'server', config.compileOptions);
const Component = (await import(`${test_dir}/_output/server/main.svelte.js`)).default;
const { body } = render(Component, { props: config.props || {}, idPrefix: config.id_prefix });
fs.writeFileSync(`${test_dir}/_output/rendered.html`, body);
if (config.ssrHtml) {
assert_html_equal_with_options(body, config.ssrHtml, {
preserveComments: config.compileOptions?.preserveComments
});
} else if (config.html) {
assert_html_equal_with_options(body, config.html, {
preserveComments: config.compileOptions?.preserveComments
});
}
} catch (err: any) {
err.stack += `\n\ncmd-click: ${path.relative(process.cwd(), test_dir)}/main.svelte`;
throw err;
}
// wait for vitest to report progress
await setImmediate();
}
const { run } = suite<ReturnType<typeof import('./assert').test>>(async (config, test_dir) => {
if (config.mode && !config.mode.includes('server')) return;
if (config.skip_mode?.includes('server')) return;
await run_ssr_test(config, test_dir);
});
describe('runtime-browser (ssr)', async () => {
await run(__dirname);
});
Domain
Subdomains
Functions
Dependencies
- assert_html_equal_with_options
- compile_directory
- helpers.js
- html_equal.js
- node:fs
- node:path
- promises
- server
- suite
- suite.ts
- vitest
Source
Frequently Asked Questions
What does test-ssr.ts do?
test-ssr.ts is a source file in the svelte codebase, written in typescript. It belongs to the BuildSystem domain, MessageProcessor subdomain.
What functions are defined in test-ssr.ts?
test-ssr.ts defines 1 function(s): run_ssr_test.
What does test-ssr.ts depend on?
test-ssr.ts imports 11 module(s): assert_html_equal_with_options, compile_directory, helpers.js, html_equal.js, node:fs, node:path, promises, server, and 3 more.
Where is test-ssr.ts in the architecture?
test-ssr.ts is located at packages/svelte/tests/runtime-browser/test-ssr.ts (domain: BuildSystem, subdomain: MessageProcessor, directory: packages/svelte/tests/runtime-browser).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free