Home / File/ build-assets.test.js — astro Source File

build-assets.test.js — astro Source File

Architecture documentation for build-assets.test.js, a javascript file in the astro codebase. 7 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  ab7bced8_58a8_d751_aa84_deea065539d8["build-assets.test.js"]
  f74e6857_2aed_eafd_1ff5_7f274fe98cd5["deps.mjs"]
  ab7bced8_58a8_d751_aa84_deea065539d8 --> f74e6857_2aed_eafd_1ff5_7f274fe98cd5
  be670a78_841c_46e5_0af5_c5c328869ecb["test-adapter.js"]
  ab7bced8_58a8_d751_aa84_deea065539d8 --> be670a78_841c_46e5_0af5_c5c328869ecb
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  ab7bced8_58a8_d751_aa84_deea065539d8 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"]
  ab7bced8_58a8_d751_aa84_deea065539d8 --> dd4f09ce_3fd7_8295_f616_8876cda4555c
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  ab7bced8_58a8_d751_aa84_deea065539d8 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  ab7bced8_58a8_d751_aa84_deea065539d8 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  deb87372_5629_35f8_9a54_e755a08f776a["cheerio"]
  ab7bced8_58a8_d751_aa84_deea065539d8 --> deb87372_5629_35f8_9a54_e755a08f776a
  style ab7bced8_58a8_d751_aa84_deea065539d8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import assert from 'node:assert/strict';
import { before, describe, it } from 'node:test';
import * as cheerio from 'cheerio';
import { preact } from './fixtures/before-hydration/deps.mjs';
import testAdapter from './test-adapter.js';
import { loadFixture } from './test-utils.js';

describe('build assets (static)', () => {
	describe('with default configuration', () => {
		/** @type {import('./test-utils').Fixture} */
		let fixture;

		before(async () => {
			fixture = await loadFixture({
				root: './fixtures/build-assets/',
				integrations: [preact()],
				// test suite was authored when inlineStylesheets defaulted to never
				build: { inlineStylesheets: 'never' },
			});
			await fixture.build();
		});

		it('Populates /_astro directory', async () => {
			let files = await fixture.readdir('/_astro');
			assert.equal(files.length > 0, true);
		});

		it('Defaults to flat /_astro output', async () => {
			let files = await fixture.readdir('/_astro');
			for (const file of files) {
				assert.equal(file.slice(1).includes('/'), false);
			}
		});

		it('emits CSS assets to /_astro', async () => {
			let html = await fixture.readFile('/index.html');
			let $ = cheerio.load(html);

			assert.match($('link[href$=".css"]').attr('href'), /^\/_astro\//);
		});

		it('emits JS assets to /_astro', async () => {
			let html = await fixture.readFile('/index.html');
			let $ = cheerio.load(html);

			const island = $('astro-island');
			assert.equal(island.length, 1);
			assert.match(island.attr('component-url'), /^\/_astro\//);
			assert.match(island.attr('renderer-url'), /^\/_astro\//);
		});
	});

	describe('with custom configuration', () => {
		/** @type {import('./test-utils').Fixture} */
		let fixture;

		before(async () => {
			fixture = await loadFixture({
				root: './fixtures/build-assets/',
				integrations: [preact()],
// ... (125 more lines)

Dependencies

Frequently Asked Questions

What does build-assets.test.js do?
build-assets.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does build-assets.test.js depend on?
build-assets.test.js imports 7 module(s): cheerio, deps.mjs, loadFixture, node:test, strict, test-adapter.js, test-utils.js.
Where is build-assets.test.js in the architecture?
build-assets.test.js is located at packages/astro/test/build-assets.test.js (domain: IntegrationAdapters, directory: packages/astro/test).

Analyze Your Own Codebase

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

Try Supermodel Free