Home / File/ custom-500.test.js — astro Source File

custom-500.test.js — astro Source File

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

Entity Profile

Dependency Diagram

graph LR
  f7276263_e489_aab2_e1c8_9255f24a6fc7["custom-500.test.js"]
  be670a78_841c_46e5_0af5_c5c328869ecb["test-adapter.js"]
  f7276263_e489_aab2_e1c8_9255f24a6fc7 --> be670a78_841c_46e5_0af5_c5c328869ecb
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  f7276263_e489_aab2_e1c8_9255f24a6fc7 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"]
  f7276263_e489_aab2_e1c8_9255f24a6fc7 --> dd4f09ce_3fd7_8295_f616_8876cda4555c
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  f7276263_e489_aab2_e1c8_9255f24a6fc7 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  e16a223b_37f3_6b25_1ee1_2b7bcb9d9415["node:fs"]
  f7276263_e489_aab2_e1c8_9255f24a6fc7 --> e16a223b_37f3_6b25_1ee1_2b7bcb9d9415
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  f7276263_e489_aab2_e1c8_9255f24a6fc7 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  deb87372_5629_35f8_9a54_e755a08f776a["cheerio"]
  f7276263_e489_aab2_e1c8_9255f24a6fc7 --> deb87372_5629_35f8_9a54_e755a08f776a
  style f7276263_e489_aab2_e1c8_9255f24a6fc7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import assert from 'node:assert/strict';
import { renameSync } from 'node:fs';
import { afterEach, describe, it } from 'node:test';
import * as cheerio from 'cheerio';
import testAdapter from './test-adapter.js';
import { loadFixture } from './test-utils.js';

describe('Custom 500', () => {
	/** @type {Awaited<ReturnType<typeof loadFixture>>} */
	let fixture;

	describe('dev', () => {
		/** @type {Awaited<ReturnType<(typeof fixture)["startDevServer"]>>} */
		let devServer;

		afterEach(async () => {
			await devServer?.stop();
			try {
				renameSync(
					new URL('./fixtures/custom-500/src/pages/_500.astro', import.meta.url),
					new URL('./fixtures/custom-500/src/pages/500.astro', import.meta.url),
				);
			} catch (_) {}
		});

		it('renders default error overlay', async () => {
			renameSync(
				new URL('./fixtures/custom-500/src/pages/500.astro', import.meta.url),
				new URL('./fixtures/custom-500/src/pages/_500.astro', import.meta.url),
			);
			fixture = await loadFixture({
				root: './fixtures/custom-500/',
				output: 'server',
				adapter: testAdapter(),
			});
			devServer = await fixture.startDevServer();

			const response = await fixture.fetch('/');
			assert.equal(response.status, 500);

			const html = await response.text();

			assert.equal(html, '<title>Error</title><script type="module" src="/@vite/client"></script>');
		});

		it('renders custom 500', async () => {
			fixture = await loadFixture({
				root: './fixtures/custom-500/',
				output: 'server',
				adapter: testAdapter(),
			});
			devServer = await fixture.startDevServer();

			const response = await fixture.fetch('/');
			assert.equal(response.status, 500);

			const html = await response.text();
			const $ = cheerio.load(html);

			assert.equal($('h1').text(), 'Server error');
// ... (106 more lines)

Dependencies

Frequently Asked Questions

What does custom-500.test.js do?
custom-500.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does custom-500.test.js depend on?
custom-500.test.js imports 7 module(s): cheerio, loadFixture, node:fs, node:test, strict, test-adapter.js, test-utils.js.
Where is custom-500.test.js in the architecture?
custom-500.test.js is located at packages/astro/test/custom-500.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