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. 3 imports, 11 dependents.

File javascript CoreAstro CoreMiddleware 3 imports 11 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  4b1e6526_afae_1cc3_9eb4_67fe4c476b26["test-utils.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  4b1e6526_afae_1cc3_9eb4_67fe4c476b26 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"]
  4b1e6526_afae_1cc3_9eb4_67fe4c476b26 --> dd4f09ce_3fd7_8295_f616_8876cda4555c
  9912c6b7_6937_4418_a7cc_cd9eb70574c0["xml2js"]
  4b1e6526_afae_1cc3_9eb4_67fe4c476b26 --> 9912c6b7_6937_4418_a7cc_cd9eb70574c0
  90d322f7_ad74_41a4_161e_81bac1e24726["base-path.test.js"]
  90d322f7_ad74_41a4_161e_81bac1e24726 --> 4b1e6526_afae_1cc3_9eb4_67fe4c476b26
  9fad7920_e098_36ef_2631_8ccfd1440ea5["chunks-files.test.js"]
  9fad7920_e098_36ef_2631_8ccfd1440ea5 --> 4b1e6526_afae_1cc3_9eb4_67fe4c476b26
  755a08ee_a011_8466_5538_d6c32a73bb5b["config.test.js"]
  755a08ee_a011_8466_5538_d6c32a73bb5b --> 4b1e6526_afae_1cc3_9eb4_67fe4c476b26
  6153fb06_0f6f_53b3_262a_41a83d96c994["custom-pages.test.js"]
  6153fb06_0f6f_53b3_262a_41a83d96c994 --> 4b1e6526_afae_1cc3_9eb4_67fe4c476b26
  18b09de2_c704_9927_4702_9e5e2ae773e0["custom-sitemaps.test.js"]
  18b09de2_c704_9927_4702_9e5e2ae773e0 --> 4b1e6526_afae_1cc3_9eb4_67fe4c476b26
  0489ad94_db6a_2983_5fa0_d35836e391f1["dynamic-path.test.js"]
  0489ad94_db6a_2983_5fa0_d35836e391f1 --> 4b1e6526_afae_1cc3_9eb4_67fe4c476b26
  8e21d0d5_ba01_eb23_5d25_b50f91f41f44["namespaces.test.js"]
  8e21d0d5_ba01_eb23_5d25_b50f91f41f44 --> 4b1e6526_afae_1cc3_9eb4_67fe4c476b26
  fd78463f_09a0_d4aa_9bfe_98fa7800cca6["routes.test.js"]
  fd78463f_09a0_d4aa_9bfe_98fa7800cca6 --> 4b1e6526_afae_1cc3_9eb4_67fe4c476b26
  74670282_ca9d_0ef1_81b2_214d621c796c["ssr.test.js"]
  74670282_ca9d_0ef1_81b2_214d621c796c --> 4b1e6526_afae_1cc3_9eb4_67fe4c476b26
  72fba1ee_2f28_60d8_db46_b02629c45c47["staticPaths.test.js"]
  72fba1ee_2f28_60d8_db46_b02629c45c47 --> 4b1e6526_afae_1cc3_9eb4_67fe4c476b26
  2c33a093_fe30_ab72_639d_a0321d27fc2b["trailing-slash.test.js"]
  2c33a093_fe30_ab72_639d_a0321d27fc2b --> 4b1e6526_afae_1cc3_9eb4_67fe4c476b26
  style 4b1e6526_afae_1cc3_9eb4_67fe4c476b26 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

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

/**
 * @typedef {import('../../../astro/test/test-utils').Fixture} Fixture
 */

export 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`
	return baseLoadFixture({
		...inlineConfig,
		root: new URL(inlineConfig.root, import.meta.url).toString(),
	});
}

export function readXML(fileOrPromise) {
	const parseString = xml2js.parseString;
	return Promise.resolve(fileOrPromise).then((xml) => {
		return new Promise((resolve, reject) => {
			parseString(xml, function (err, result) {
				if (err) return reject(err);
				resolve(result);
			});
		});
	});
}

Domain

Subdomains

Dependencies

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, CoreMiddleware subdomain.
What functions are defined in test-utils.js?
test-utils.js defines 2 function(s): loadFixture, readXML.
What does test-utils.js depend on?
test-utils.js imports 3 module(s): loadFixture, test-utils.js, xml2js.
What files import test-utils.js?
test-utils.js is imported by 11 file(s): base-path.test.js, chunks-files.test.js, config.test.js, custom-pages.test.js, custom-sitemaps.test.js, dynamic-path.test.js, namespaces.test.js, routes.test.js, and 3 more.
Where is test-utils.js in the architecture?
test-utils.js is located at packages/integrations/sitemap/test/test-utils.js (domain: CoreAstro, subdomain: CoreMiddleware, directory: packages/integrations/sitemap/test).

Analyze Your Own Codebase

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

Try Supermodel Free