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

test-utils.js — astro Source File

Architecture documentation for test-utils.js, a javascript file in the astro codebase. 15 imports, 310 dependents.

File javascript IntegrationAdapters SsrAdapters 15 imports 310 dependents 7 functions

Entity Profile

Dependency Diagram

graph LR
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  765ca746_2e88_9293_61ca_571d67a38135["../dist/cli/check/index.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15 --> 765ca746_2e88_9293_61ca_571d67a38135
  cd0b5388_b96d_d080_37f5_807cc7da86c6["../dist/content/content-layer.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15 --> cd0b5388_b96d_d080_37f5_807cc7da86c6
  4fc0ebf6_9d32_74a0_fbd7_52731484bef6["../../../dist/content/utils.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15 --> 4fc0ebf6_9d32_74a0_fbd7_52731484bef6
  8f7d53a8_e256_dcdf_d2cc_b03672c01493["../dist/core/build/index.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15 --> 8f7d53a8_e256_dcdf_d2cc_b03672c01493
  011fcd63_bba9_72a2_e9be_9bc0a8c48876["../../dist/core/config/index.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15 --> 011fcd63_bba9_72a2_e9be_9bc0a8c48876
  e8243f4d_e87e_1b92_602c_5ba2a7519189["../dist/core/index.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15 --> e8243f4d_e87e_1b92_602c_5ba2a7519189
  3b23d4b1_bfa2_40a9_f0c4_0746f8840c65["../dist/core/sync/index.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15 --> 3b23d4b1_bfa2_40a9_f0c4_0746f8840c65
  dc804f3e_b1ea_df4a_3cc9_40b536be6a5d["node:child_process"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15 --> dc804f3e_b1ea_df4a_3cc9_40b536be6a5d
  e16a223b_37f3_6b25_1ee1_2b7bcb9d9415["node:fs"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15 --> e16a223b_37f3_6b25_1ee1_2b7bcb9d9415
  b326953c_dc9d_ec9e_dc34_4beead549f6e["node:os"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15 --> b326953c_dc9d_ec9e_dc34_4beead549f6e
  c52a5f83_66e3_37d7_9ebb_767f7129bc62["node:path"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15 --> c52a5f83_66e3_37d7_9ebb_767f7129bc62
  d9a92db9_c95e_9165_13ac_24b3d859d946["node:url"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15 --> d9a92db9_c95e_9165_13ac_24b3d859d946
  b4a76fc8_3591_85b4_7b57_55ab21d1030d["node:util"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15 --> b4a76fc8_3591_85b4_7b57_55ab21d1030d
  e64464d4_88a4_c7e2_f90f_758b06231bbe["tinyglobby"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15 --> e64464d4_88a4_c7e2_f90f_758b06231bbe
  style 0a624eac_945e_c9e8_c9de_3feb9de2dd15 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { spawn } from 'node:child_process';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { stripVTControlCharacters } from 'node:util';
import { glob } from 'tinyglobby';
import { Agent } from 'undici';
import { check } from '../dist/cli/check/index.js';
import { globalContentLayer } from '../dist/content/content-layer.js';
import { globalContentConfigObserver } from '../dist/content/utils.js';
import build from '../dist/core/build/index.js';
import { mergeConfig, resolveConfig } from '../dist/core/config/index.js';
import { dev, preview } from '../dist/core/index.js';
import sync from '../dist/core/sync/index.js';

// Disable telemetry when running tests
process.env.ASTRO_TELEMETRY_DISABLED = true;

/**
 * @typedef {import('../src/core/dev/dev').DevServer} DevServer
 * @typedef {Omit<import('../src/types/public/config.js').AstroInlineConfig, 'root'> & { root?: string | URL }} AstroInlineConfig
 * @typedef {import('../src/types/public/config.js').AstroConfig} AstroConfig
 * @typedef {import('../src/core/preview/index').PreviewServer} PreviewServer
 * @typedef {import('../src/core/app/index').App} App
 * @typedef {import('../src/cli/check/index').AstroChecker} AstroChecker
 * @typedef {import('../src/cli/check/index').CheckPayload} CheckPayload
 * @typedef {import('http').IncomingMessage} NodeRequest
 * @typedef {import('http').ServerResponse} NodeResponse
 *
 *
 * @typedef {Object} Fixture
 * @property {typeof build} build
 * @property {(url: string) => string} resolveUrl
 * @property {(path: string) => Promise<boolean>} pathExists
 * @property {(url: string, opts?: Parameters<typeof fetch>[1]) => Promise<Response>} fetch
 * @property {(path: string) => Promise<string>} readFile
 * @property {(path: string, updater: (content: string) => string, waitForNextWrite = true) => Promise<() => void>} editFile
 * @property {(path: string) => Promise<string[]>} readdir
 * @property {(pattern: string) => Promise<string[]>} glob
 * @property {(inlineConfig?: Parameters<typeof dev>[0]) => ReturnType<typeof dev>} startDevServer
 * @property {typeof preview} preview
 * @property {() => Promise<void>} clean
 * @property {() => Promise<App>} loadTestAdapterApp
 * @property {() => Promise<(req: NodeRequest, res: NodeResponse) => void>} loadNodeAdapterHandler
 * @property {(timeout?: number) => Promise<void>} onNextDataStoreChange
 * @property {typeof check} check
 * @property {typeof sync} sync
 * @property {AstroConfig} config
 * @property {() => void} resetAllFiles
 *
 * This function returns an instance of the Check
 *
 *
 * When used in a test suite:
 * ```js
 * let fixture = await loadFixture({
 *   root: './fixtures/astro-check-watch/',
 * });
 * ```
// ... (354 more lines)

Subdomains

Dependencies

  • ../../../dist/content/utils.js
  • ../../dist/core/config/index.js
  • ../dist/cli/check/index.js
  • ../dist/content/content-layer.js
  • ../dist/core/build/index.js
  • ../dist/core/index.js
  • ../dist/core/sync/index.js
  • node:child_process
  • node:fs
  • node:os
  • node:path
  • node:url
  • node:util
  • tinyglobby
  • undici

Imported By

Frequently Asked Questions

What does test-utils.js do?
test-utils.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 test-utils.js?
test-utils.js defines 7 function(s): cli, cliServerLogSetup, fixLineEndings, loadFixture, parseAddressToHost, parseCliDevStart, streamAsyncIterator.
What does test-utils.js depend on?
test-utils.js imports 15 module(s): ../../../dist/content/utils.js, ../../dist/core/config/index.js, ../dist/cli/check/index.js, ../dist/content/content-layer.js, ../dist/core/build/index.js, ../dist/core/index.js, ../dist/core/sync/index.js, node:child_process, and 7 more.
What files import test-utils.js?
test-utils.js is imported by 310 file(s): 0-css.test.js, _test-utils.js, actions.test.js, alias-tsconfig-no-baseurl.test.js, alias-tsconfig.test.js, alias.test.js, api-routes.test.js, asset-query-params.test.js, and 302 more.
Where is test-utils.js in the architecture?
test-utils.js is located at packages/astro/test/test-utils.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