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

index.test.js — astro Source File

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

Entity Profile

Dependency Diagram

graph LR
  37485348_ae41_5c30_d524_1889112e3a2c["index.test.js"]
  1aa9752e_e9f0_d0c4_a70e_146bf711d2b8["../../../dist/cli/infra/build-time-astro-version-provider.js"]
  37485348_ae41_5c30_d524_1889112e3a2c --> 1aa9752e_e9f0_d0c4_a70e_146bf711d2b8
  1816296b_c988_ff2c_aeaa_a70d17b4758c["../../../dist/cli/infra/cli-command-runner.js"]
  37485348_ae41_5c30_d524_1889112e3a2c --> 1816296b_c988_ff2c_aeaa_a70d17b4758c
  04a9d4be_2670_5a1c_2065_2bd15cd7b660["../../../dist/cli/infra/logger-help-display.js"]
  37485348_ae41_5c30_d524_1889112e3a2c --> 04a9d4be_2670_5a1c_2065_2bd15cd7b660
  465e618b_26b4_070b_bba4_63e8c3d26a6a["../../../dist/cli/infra/passthrough-text-styler.js"]
  37485348_ae41_5c30_d524_1889112e3a2c --> 465e618b_26b4_070b_bba4_63e8c3d26a6a
  e8d7be57_e5dd_ee4b_14e5_6fe59195a940["../../../dist/cli/infra/process-operating-system-provider.js"]
  37485348_ae41_5c30_d524_1889112e3a2c --> e8d7be57_e5dd_ee4b_14e5_6fe59195a940
  c3b24827_f891_997a_5f1f_05f9ba305bad["package.json"]
  37485348_ae41_5c30_d524_1889112e3a2c --> c3b24827_f891_997a_5f1f_05f9ba305bad
  b0be4d0c_86b6_a283_f2af_003189bfd572["test-utils.js"]
  37485348_ae41_5c30_d524_1889112e3a2c --> b0be4d0c_86b6_a283_f2af_003189bfd572
  e6d936de_adfc_6f29_c26b_58af0a66adc5["SpyLogger"]
  37485348_ae41_5c30_d524_1889112e3a2c --> e6d936de_adfc_6f29_c26b_58af0a66adc5
  dc38b823_10e6_0080_9a8c_08dc7cc3e0eb["utils.js"]
  37485348_ae41_5c30_d524_1889112e3a2c --> dc38b823_10e6_0080_9a8c_08dc7cc3e0eb
  b1804279_9a3b_87e5_cf71_6df4888a386a["FakeAstroVersionProvider"]
  37485348_ae41_5c30_d524_1889112e3a2c --> b1804279_9a3b_87e5_cf71_6df4888a386a
  1ca1cf9d_9383_6aa7_61a3_640f968801d7["SpyHelpDisplay"]
  37485348_ae41_5c30_d524_1889112e3a2c --> 1ca1cf9d_9383_6aa7_61a3_640f968801d7
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  37485348_ae41_5c30_d524_1889112e3a2c --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  37485348_ae41_5c30_d524_1889112e3a2c --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  style 37485348_ae41_5c30_d524_1889112e3a2c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// @ts-check
import assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { BuildTimeAstroVersionProvider } from '../../../dist/cli/infra/build-time-astro-version-provider.js';
import { CliCommandRunner } from '../../../dist/cli/infra/cli-command-runner.js';
import { LoggerHelpDisplay } from '../../../dist/cli/infra/logger-help-display.js';
import { PassthroughTextStyler } from '../../../dist/cli/infra/passthrough-text-styler.js';
import { ProcessOperatingSystemProvider } from '../../../dist/cli/infra/process-operating-system-provider.js';
import packageJson from '../../../package.json' with { type: 'json' };
import { SpyLogger } from '../test-utils.js';
import { FakeAstroVersionProvider, SpyHelpDisplay } from './utils.js';

describe('CLI shared', () => {
	describe('infra', () => {
		describe('CliCommandRunner', () => {
			it('logs the help if it should fire', () => {
				const helpDisplay = new SpyHelpDisplay(true);
				const runner = new CliCommandRunner({ helpDisplay });
				let ran = false;

				runner.run({
					help: {
						commandName: 'foo',
					},
					run: () => {
						ran = true;
					},
				});

				assert.equal(helpDisplay.payloads.length, 1);
				assert.equal(ran, false);
			});

			it('does not log the help if it should not should fire', () => {
				const helpDisplay = new SpyHelpDisplay(false);
				const runner = new CliCommandRunner({ helpDisplay });
				let ran = false;

				runner.run({
					help: {
						commandName: 'foo',
					},
					run: () => {
						ran = true;
					},
				});

				assert.equal(helpDisplay.payloads.length, 0);
				assert.equal(ran, true);
			});
		});

		describe('BuildTimeAstroVersionProvider', () => {
			it('returns the value from the build', () => {
				const astroVersionProvider = new BuildTimeAstroVersionProvider();

				assert.equal(astroVersionProvider.version, packageJson.version);
			});
		});

// ... (113 more lines)

Dependencies

Frequently Asked Questions

What does index.test.js do?
index.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does index.test.js depend on?
index.test.js imports 13 module(s): ../../../dist/cli/infra/build-time-astro-version-provider.js, ../../../dist/cli/infra/cli-command-runner.js, ../../../dist/cli/infra/logger-help-display.js, ../../../dist/cli/infra/passthrough-text-styler.js, ../../../dist/cli/infra/process-operating-system-provider.js, FakeAstroVersionProvider, SpyHelpDisplay, SpyLogger, and 5 more.
Where is index.test.js in the architecture?
index.test.js is located at packages/astro/test/units/cli/index.test.js (domain: IntegrationAdapters, directory: packages/astro/test/units/cli).

Analyze Your Own Codebase

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

Try Supermodel Free