Home / File/ _test-utils.js — astro Source File

_test-utils.js — astro Source File

Architecture documentation for _test-utils.js, a javascript file in the astro codebase. 2 imports, 16 dependents.

File javascript CoreAstro RoutingSystem 2 imports 16 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  635e1221_67bb_e784_624a_d6d63643872b["_test-utils.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  635e1221_67bb_e784_624a_d6d63643872b --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"]
  635e1221_67bb_e784_624a_d6d63643872b --> dd4f09ce_3fd7_8295_f616_8876cda4555c
  6d864234_73bd_7615_4440_c38e85aa668f["astro-dev-platform.test.js"]
  6d864234_73bd_7615_4440_c38e85aa668f --> 635e1221_67bb_e784_624a_d6d63643872b
  6e447c0f_5b60_9bad_dfbf_bc64627f1675["astro-env.test.js"]
  6e447c0f_5b60_9bad_dfbf_bc64627f1675 --> 635e1221_67bb_e784_624a_d6d63643872b
  64190c7d_d974_38e0_d87d_96e14ded22d9["binding-image-service.test.js"]
  64190c7d_d974_38e0_d87d_96e14ded22d9 --> 635e1221_67bb_e784_624a_d6d63643872b
  fd4af722_4ae0_67f5_e5af_f6262c76050a["compile-image-service.test.js"]
  fd4af722_4ae0_67f5_e5af_f6262c76050a --> 635e1221_67bb_e784_624a_d6d63643872b
  6d393757_e876_9c3f_66cd_dc37532a32c4["custom-entryfile.test.js"]
  6d393757_e876_9c3f_66cd_dc37532a32c4 --> 635e1221_67bb_e784_624a_d6d63643872b
  41d11a2c_68a2_069c_5c88_ba8b12115c78["external-image-service.test.js"]
  41d11a2c_68a2_069c_5c88_ba8b12115c78 --> 635e1221_67bb_e784_624a_d6d63643872b
  d19422b5_4b6d_12d4_170d_71382a7acb44["prerender-styles.test.js"]
  d19422b5_4b6d_12d4_170d_71382a7acb44 --> 635e1221_67bb_e784_624a_d6d63643872b
  0bc1472a_0a28_f928_208f_19e931dbfcdb["routes-json.test.js"]
  0bc1472a_0a28_f928_208f_19e931dbfcdb --> 635e1221_67bb_e784_624a_d6d63643872b
  e2b26754_1504_8a2a_b870_797c2ac24bd9["routing-priority.test.js"]
  e2b26754_1504_8a2a_b870_797c2ac24bd9 --> 635e1221_67bb_e784_624a_d6d63643872b
  78abe30b_5c3c_1fbc_340e_669bc468c433["server-entry.test.js"]
  78abe30b_5c3c_1fbc_340e_669bc468c433 --> 635e1221_67bb_e784_624a_d6d63643872b
  6e32da71_4d59_751f_de0a_380b0e3051c2["sessions.test.js"]
  6e32da71_4d59_751f_de0a_380b0e3051c2 --> 635e1221_67bb_e784_624a_d6d63643872b
  4afa8105_dba4_bcf7_d410_51c6f3ee27d0["sql-import.test.js"]
  4afa8105_dba4_bcf7_d410_51c6f3ee27d0 --> 635e1221_67bb_e784_624a_d6d63643872b
  style 635e1221_67bb_e784_624a_d6d63643872b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { loadFixture as baseLoadFixture } from '../../../astro/test/test-utils.js';

/**
 * @typedef {import('../../../astro/test/test-utils').Fixture} Fixture
 */
export async function loadFixture(inlineConfig) {
	if (!inlineConfig?.root) throw new Error("Must provide { root: './fixtures/...' }");

	// 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`
	const fixture = await baseLoadFixture({
		...inlineConfig,
		root: new URL(inlineConfig.root, import.meta.url).toString(),
	});

	// For unknown reasons, the error below could raise during testing. We add a retry mechanism to handle it.
	// Some further investigation is needed to understand the root cause.
	//
	// Unable to build fixture for the attempt 1: Error: There is a new version of the pre-bundle for "/astro/packages/integrations/cloudflare/test/fixtures/with-svelte/node_modules/.vite/deps_ssr/svelte_server.js?v=9924cddf", a page reload is going to ask for it.
	const buildWithRetry = async function (...args) {
		let err;
		for (let attempt = 1; attempt <= 3; attempt++) {
			try {
				const result = await fixture.build(...args);
				return result;
			} catch (error) {
				console.error(`Unable to build fixture for the attempt ${attempt}:`, error);
				err = error;
			}
		}

		if (err) {
			throw err;
		}
	};

	return { ...fixture, build: buildWithRetry };
}

Domain

Subdomains

Functions

Frequently Asked Questions

What does _test-utils.js do?
_test-utils.js is a source file in the astro codebase, written in javascript. It belongs to the CoreAstro domain, RoutingSystem subdomain.
What functions are defined in _test-utils.js?
_test-utils.js defines 1 function(s): loadFixture.
What does _test-utils.js depend on?
_test-utils.js imports 2 module(s): loadFixture, test-utils.js.
What files import _test-utils.js?
_test-utils.js is imported by 16 file(s): astro-dev-platform.test.js, astro-env.test.js, binding-image-service.test.js, compile-image-service.test.js, custom-entryfile.test.js, external-image-service.test.js, prerender-styles.test.js, routes-json.test.js, and 8 more.
Where is _test-utils.js in the architecture?
_test-utils.js is located at packages/integrations/cloudflare/test/_test-utils.js (domain: CoreAstro, subdomain: RoutingSystem, directory: packages/integrations/cloudflare/test).

Analyze Your Own Codebase

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

Try Supermodel Free