Home / File/ frontmatter.test.js — astro Source File

frontmatter.test.js — astro Source File

Architecture documentation for frontmatter.test.js, a javascript file in the astro codebase. 5 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  eda858a0_e4a3_0a1b_b79a_c67c2b2d5e50["frontmatter.test.js"]
  5de6f30a_3458_af77_4e18_0bb353977acc["../../../dist/content/index.js"]
  eda858a0_e4a3_0a1b_b79a_c67c2b2d5e50 --> 5de6f30a_3458_af77_4e18_0bb353977acc
  b0be4d0c_86b6_a283_f2af_003189bfd572["test-utils.js"]
  eda858a0_e4a3_0a1b_b79a_c67c2b2d5e50 --> b0be4d0c_86b6_a283_f2af_003189bfd572
  f0937d94_cf30_e0fa_fbd5_135f8c876f70["createFixture"]
  eda858a0_e4a3_0a1b_b79a_c67c2b2d5e50 --> f0937d94_cf30_e0fa_fbd5_135f8c876f70
  f09af995_6d60_a9f3_bdf0_6ae561f198cb["runInContainer"]
  eda858a0_e4a3_0a1b_b79a_c67c2b2d5e50 --> f09af995_6d60_a9f3_bdf0_6ae561f198cb
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  eda858a0_e4a3_0a1b_b79a_c67c2b2d5e50 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  style eda858a0_e4a3_0a1b_b79a_c67c2b2d5e50 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { describe, it } from 'node:test';
import { attachContentServerListeners } from '../../../dist/content/index.js';
import { createFixture, runInContainer } from '../test-utils.js';

describe('frontmatter', () => {
	it('errors in content/ does not crash server', async () => {
		const fixture = await createFixture({
			'/src/content/posts/blog.md': `\
					---
					title: One
					---
				`,
			'/src/content.config.ts': `\
					import { defineCollection } from 'astro:content';
					import { z } from 'astro/zod';
					import { glob } from 'astro/loaders';

					const posts = defineCollection({
						loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/posts' }),
						schema: z.string()
					});

					export const collections = {
						posts
					};
				`,
			'/src/pages/index.astro': `\
					---
					---
					<html>
						<head><title>Test</title></head>
						<body class="one">
							<h1>Test</h1>
						</body>
					</html>
				`,
		});

		await runInContainer({ inlineConfig: { root: fixture.path } }, async (container) => {
			await attachContentServerListeners(container);

			await fixture.writeFile(
				'/src/content/posts/blog.md',
				`
				---
				title: One
				title: two
				---
				`,
			);
			await new Promise((resolve) => setTimeout(resolve, 100));
			// Note, if we got here, it didn't crash
		});
	});
});

Dependencies

Frequently Asked Questions

What does frontmatter.test.js do?
frontmatter.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does frontmatter.test.js depend on?
frontmatter.test.js imports 5 module(s): ../../../dist/content/index.js, createFixture, node:test, runInContainer, test-utils.js.
Where is frontmatter.test.js in the architecture?
frontmatter.test.js is located at packages/astro/test/units/content-collections/frontmatter.test.js (domain: IntegrationAdapters, directory: packages/astro/test/units/content-collections).

Analyze Your Own Codebase

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

Try Supermodel Free