Home / Function/ loadFixture() — astro Function Reference

loadFixture() — astro Function Reference

Architecture documentation for the loadFixture() function in test-utils.js from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  019f0b9c_f317_8761_c903_c4c521c6970a["loadFixture()"]
  2ca394f6_a63d_3921_1f12_c5a979ea0039["test-utils.js"]
  019f0b9c_f317_8761_c903_c4c521c6970a -->|defined in| 2ca394f6_a63d_3921_1f12_c5a979ea0039
  701ac94d_853c_16ca_535a_09b07a3947fb["test.astro()"]
  701ac94d_853c_16ca_535a_09b07a3947fb -->|calls| 019f0b9c_f317_8761_c903_c4c521c6970a
  e27f6887_ea47_dd44_7933_5faa0f6bcf4d["testFactory()"]
  e27f6887_ea47_dd44_7933_5faa0f6bcf4d -->|calls| 019f0b9c_f317_8761_c903_c4c521c6970a
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture()"]
  019f0b9c_f317_8761_c903_c4c521c6970a -->|calls| dd4f09ce_3fd7_8295_f616_8876cda4555c
  style 019f0b9c_f317_8761_c903_c4c521c6970a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/e2e/test-utils.js lines 21–43

export function loadFixture(testFile, inlineConfig) {
	if (!inlineConfig?.root) throw new Error("Must provide { root: './fixtures/...' }");

	const port = testFileToPort.get(path.basename(testFile));

	// resolve the relative root (i.e. "./fixtures/tailwindcss") to a full filepath
	// without this, the main `loadFixture` helper will resolve relative to `packages/astro/test`
	return baseLoadFixture({
		...inlineConfig,
		root: fileURLToPath(new URL(inlineConfig.root, import.meta.url)),
		server: {
			...inlineConfig?.server,
			port,
		},
		vite: {
			...inlineConfig?.vite,
			server: {
				...inlineConfig?.vite?.server,
				strictPort: true,
			},
		},
	});
}

Domain

Subdomains

Frequently Asked Questions

What does loadFixture() do?
loadFixture() is a function in the astro codebase, defined in packages/astro/e2e/test-utils.js.
Where is loadFixture() defined?
loadFixture() is defined in packages/astro/e2e/test-utils.js at line 21.
What does loadFixture() call?
loadFixture() calls 1 function(s): loadFixture.
What calls loadFixture()?
loadFixture() is called by 2 function(s): test.astro, testFactory.

Analyze Your Own Codebase

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

Try Supermodel Free