Home / File/ solid-component.test.js — astro Source File

solid-component.test.js — astro Source File

Architecture documentation for solid-component.test.js, a javascript file in the astro codebase. 5 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  3ca6ecbf_cbec_c92e_be6f_54976de6eedd["solid-component.test.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  3ca6ecbf_cbec_c92e_be6f_54976de6eedd --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"]
  3ca6ecbf_cbec_c92e_be6f_54976de6eedd --> dd4f09ce_3fd7_8295_f616_8876cda4555c
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  3ca6ecbf_cbec_c92e_be6f_54976de6eedd --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  3ca6ecbf_cbec_c92e_be6f_54976de6eedd --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  deb87372_5629_35f8_9a54_e755a08f776a["cheerio"]
  3ca6ecbf_cbec_c92e_be6f_54976de6eedd --> deb87372_5629_35f8_9a54_e755a08f776a
  style 3ca6ecbf_cbec_c92e_be6f_54976de6eedd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import assert from 'node:assert/strict';
import { after, before, describe, it } from 'node:test';
import * as cheerio from 'cheerio';
import { isWindows, loadFixture } from './test-utils.js';

describe.skip('Solid component build', { todo: 'Check why an error is thrown.' }, () => {
	let fixture;
	before(async () => {
		fixture = await loadFixture({
			root: './fixtures/solid-component/',
		});
		await fixture.build();
	});

	it('Can load a component', async () => {
		const html = await fixture.readFile('/index.html');
		const $ = cheerio.load(html);

		// test 1: Works
		assert.equal($('.hello').length, 1);

		// test 2: Support rendering proxy components
		assert.equal($('#proxy-component').text(), 'Hello world');
	});

	// ssr-client-none.astro
	it('Supports server only components', async () => {
		const html = await fixture.readFile('ssr-client-none/index.html');
		const hydrationScriptCount = countHydrationScripts(html);
		assert.equal(hydrationScriptCount, 0);
		const hydrationEventsCount = countHydrationEvents(html);
		assert.equal(hydrationEventsCount, 0);
	});

	it('Supports lazy server only components', async () => {
		const html = await fixture.readFile('ssr-client-none/index.html');
		const $ = cheerio.load(html);
		// AsyncComponent renders 1 button
		// LazyCounter renders 4 buttons
		// Total is 5 buttons
		assert.equal($('button').length, 5);
	});

	// ssr-client-none-throwing.astro
	it('Supports server only components with error boundaries', async () => {
		const html = await fixture.readFile('ssr-client-none-throwing/index.html');
		const hydrationScriptCount = countHydrationScripts(html);
		assert.equal(hydrationScriptCount, 0);
		assert.equal(html.includes('Async error boundary fallback'), true);
		assert.equal(html.includes('Sync error boundary fallback'), true);
		const hydrationEventsCount = countHydrationEvents(html);
		assert.equal(hydrationEventsCount, 0);
	});

	// ssr-client-load.astro
	it('Supports hydrating components', async () => {
		const html = await fixture.readFile('ssr-client-load/index.html');
		const hydrationScriptCount = countHydrationScripts(html);
		assert.equal(hydrationScriptCount, 1);
	});
// ... (153 more lines)

Subdomains

Dependencies

Frequently Asked Questions

What does solid-component.test.js do?
solid-component.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain, SsrAdapters subdomain.
What functions are defined in solid-component.test.js?
solid-component.test.js defines 6 function(s): countHydrationEvents, countHydrationScripts, createHydrationEventRegex, createHydrationScriptRegex, getFirstHydrationEventLocation, getFirstHydrationScriptLocation.
What does solid-component.test.js depend on?
solid-component.test.js imports 5 module(s): cheerio, loadFixture, node:test, strict, test-utils.js.
Where is solid-component.test.js in the architecture?
solid-component.test.js is located at packages/astro/test/solid-component.test.js (domain: IntegrationAdapters, subdomain: SsrAdapters, directory: packages/astro/test).

Analyze Your Own Codebase

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

Try Supermodel Free