Home / Function/ setup() — astro Function Reference

setup() — astro Function Reference

Architecture documentation for the setup() function in utils.js from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  ba39c8a0_fa83_d32e_0c60_ad5c1c131c40["setup()"]
  a235a0d7_582f_6d3a_e9ba_44a62def6ef3["utils.js"]
  ba39c8a0_fa83_d32e_0c60_ad5c1c131c40 -->|defined in| a235a0d7_582f_6d3a_e9ba_44a62def6ef3
  style ba39c8a0_fa83_d32e_0c60_ad5c1c131c40 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/create-astro/test/utils.js lines 5–32

export function setup() {
	const ctx = { messages: [] };
	before(() => {
		setStdout(
			Object.assign({}, process.stdout, {
				write(buf) {
					ctx.messages.push(stripVTControlCharacters(String(buf)).trim());
					return true;
				},
			}),
		);
	});
	beforeEach(() => {
		ctx.messages = [];
	});

	return {
		messages() {
			return ctx.messages;
		},
		length() {
			return ctx.messages.length;
		},
		hasMessage(content) {
			return !!ctx.messages.find((msg) => msg.includes(content));
		},
	};
}

Domain

Subdomains

Frequently Asked Questions

What does setup() do?
setup() is a function in the astro codebase, defined in packages/create-astro/test/utils.js.
Where is setup() defined?
setup() is defined in packages/create-astro/test/utils.js at line 5.

Analyze Your Own Codebase

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

Try Supermodel Free