Home / File/ astro-sync.test.js — astro Source File

astro-sync.test.js — astro Source File

Architecture documentation for astro-sync.test.js, a javascript file in the astro codebase. 8 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  9d62e497_e521_a9db_9c44_090a22bbaea7["astro-sync.test.js"]
  f5b154b4_7bf2_7c8f_2105_5c84d2420bd1["../../dist/core/logger/core.js"]
  9d62e497_e521_a9db_9c44_090a22bbaea7 --> f5b154b4_7bf2_7c8f_2105_5c84d2420bd1
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  9d62e497_e521_a9db_9c44_090a22bbaea7 --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"]
  9d62e497_e521_a9db_9c44_090a22bbaea7 --> dd4f09ce_3fd7_8295_f616_8876cda4555c
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  9d62e497_e521_a9db_9c44_090a22bbaea7 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  e16a223b_37f3_6b25_1ee1_2b7bcb9d9415["node:fs"]
  9d62e497_e521_a9db_9c44_090a22bbaea7 --> e16a223b_37f3_6b25_1ee1_2b7bcb9d9415
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  9d62e497_e521_a9db_9c44_090a22bbaea7 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  d9a92db9_c95e_9165_13ac_24b3d859d946["node:url"]
  9d62e497_e521_a9db_9c44_090a22bbaea7 --> d9a92db9_c95e_9165_13ac_24b3d859d946
  41525615_7e06_b0e8_f601_674c57b118ee["typescript"]
  9d62e497_e521_a9db_9c44_090a22bbaea7 --> 41525615_7e06_b0e8_f601_674c57b118ee
  style 9d62e497_e521_a9db_9c44_090a22bbaea7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// @ts-check
import assert from 'node:assert/strict';
import * as fs from 'node:fs';
import { beforeEach, describe, it } from 'node:test';
import { fileURLToPath } from 'node:url';
import ts from 'typescript';
import { Logger } from '../dist/core/logger/core.js';
import { loadFixture } from './test-utils.js';

const createFixture = () => {
	/** @type {Awaited<ReturnType<typeof loadFixture>>} */
	let astroFixture;
	/** @type {Record<string, string>} */
	const writtenFiles = {};
	/** @type {Array<string>} */
	const warnLogs = [];

	/**
	 * @param {string} path
	 */
	const getExpectedPath = (path) => fileURLToPath(new URL(path, astroFixture.config.root));

	return {
		/** @param {string} root */
		async load(root) {
			astroFixture = await loadFixture({ root });
			return astroFixture.config;
		},
		clean() {
			fs.rmSync(new URL('./.astro/', astroFixture.config.root), { force: true, recursive: true });
		},
		async whenSyncing() {
			const fsMock = {
				...fs,
				/**
				 * @param {fs.PathLike} path
				 * @param {string} contents
				 */
				writeFileSync(path, contents) {
					writtenFiles[path.toString()] = contents;
					return fs.writeFileSync(path, contents);
				},
				promises: {
					...fs.promises,
					/**
					 * @param {fs.PathLike} path
					 * @param {string} contents
					 */
					writeFile(path, contents) {
						writtenFiles[path.toString()] = contents;
						return fs.promises.writeFile(path, contents);
					},
				},
			};

			const originalWarn = console.warn;
			console.warn = (message) => {
				originalWarn(message);
				warnLogs.push(message);
			};
// ... (241 more lines)

Subdomains

Functions

Dependencies

Frequently Asked Questions

What does astro-sync.test.js do?
astro-sync.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain, SsrAdapters subdomain.
What functions are defined in astro-sync.test.js?
astro-sync.test.js defines 1 function(s): createFixture.
What does astro-sync.test.js depend on?
astro-sync.test.js imports 8 module(s): ../../dist/core/logger/core.js, loadFixture, node:fs, node:test, node:url, strict, test-utils.js, typescript.
Where is astro-sync.test.js in the architecture?
astro-sync.test.js is located at packages/astro/test/astro-sync.test.js (domain: IntegrationAdapters, subdomain: SsrAdapters, directory: packages/astro/test).

Analyze Your Own Codebase

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

Try Supermodel Free