cli.test.js — astro Source File
Architecture documentation for cli.test.js, a javascript file in the astro codebase. 14 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 64a48040_bc58_2a5b_7755_774708915f1f["cli.test.js"] 0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"] 64a48040_bc58_2a5b_7755_774708915f1f --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15 059d6180_e8b9_fe3d_9d0c_6c7c63b89996["cli"] 64a48040_bc58_2a5b_7755_774708915f1f --> 059d6180_e8b9_fe3d_9d0c_6c7c63b89996 c8ca0177_94cb_19a3_041c_d860410db478["cliServerLogSetup"] 64a48040_bc58_2a5b_7755_774708915f1f --> c8ca0177_94cb_19a3_041c_d860410db478 dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"] 64a48040_bc58_2a5b_7755_774708915f1f --> dd4f09ce_3fd7_8295_f616_8876cda4555c cbc6852f_92c6_77b8_9bb5_323cfbe7e2fe["parseCliDevStart"] 64a48040_bc58_2a5b_7755_774708915f1f --> cbc6852f_92c6_77b8_9bb5_323cfbe7e2fe e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"] 64a48040_bc58_2a5b_7755_774708915f1f --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607 dc804f3e_b1ea_df4a_3cc9_40b536be6a5d["node:child_process"] 64a48040_bc58_2a5b_7755_774708915f1f --> dc804f3e_b1ea_df4a_3cc9_40b536be6a5d e16a223b_37f3_6b25_1ee1_2b7bcb9d9415["node:fs"] 64a48040_bc58_2a5b_7755_774708915f1f --> e16a223b_37f3_6b25_1ee1_2b7bcb9d9415 155bd823_ceeb_ca16_2d83_f5ec72c22720["node:net"] 64a48040_bc58_2a5b_7755_774708915f1f --> 155bd823_ceeb_ca16_2d83_f5ec72c22720 c52a5f83_66e3_37d7_9ebb_767f7129bc62["node:path"] 64a48040_bc58_2a5b_7755_774708915f1f --> c52a5f83_66e3_37d7_9ebb_767f7129bc62 8f34f3e8_2f0f_1f0d_91dc_c25ece8c8169["node:stream"] 64a48040_bc58_2a5b_7755_774708915f1f --> 8f34f3e8_2f0f_1f0d_91dc_c25ece8c8169 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] 64a48040_bc58_2a5b_7755_774708915f1f --> 6b0635f9_51ea_77aa_767b_7857878e98a6 d9a92db9_c95e_9165_13ac_24b3d859d946["node:url"] 64a48040_bc58_2a5b_7755_774708915f1f --> d9a92db9_c95e_9165_13ac_24b3d859d946 b4a76fc8_3591_85b4_7b57_55ab21d1030d["node:util"] 64a48040_bc58_2a5b_7755_774708915f1f --> b4a76fc8_3591_85b4_7b57_55ab21d1030d style 64a48040_bc58_2a5b_7755_774708915f1f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import assert from 'node:assert/strict';
import { spawnSync } from 'node:child_process';
import { promises as fs, readFileSync } from 'node:fs';
import { isIPv4 } from 'node:net';
import { join } from 'node:path';
import { Writable } from 'node:stream';
import { describe, it } from 'node:test';
import { fileURLToPath } from 'node:url';
import { stripVTControlCharacters } from 'node:util';
import { cli, cliServerLogSetup, loadFixture, parseCliDevStart } from './test-utils.js';
/**
* Throws an error if no command is found for the current OS.
* @returns {string}
*/
function readFromClipboard() {
const system = process.platform;
let command = '';
let args = [];
if (system === 'darwin') {
command = 'pbpaste';
} else if (system === 'win32') {
command = 'powershell';
args = ['-command', 'Get-Clipboard'];
} else {
const unixCommands = [
['xclip', ['-sel', 'clipboard', '-o']],
['wl-paste', []],
];
for (const [unixCommand, unixArgs] of unixCommands) {
try {
const output = spawnSync('which', [unixCommand], { encoding: 'utf8' });
if (output.stdout.trim()) {
command = unixCommand;
args = unixArgs;
break;
}
} catch {
continue;
}
}
}
if (!command) {
throw new Error('Clipboard read command not found!');
}
const result = spawnSync(command, args, { encoding: 'utf8' });
if (result.error) {
throw result.error;
}
return result.stdout.trim();
}
describe('astro cli', () => {
const cliServerLogSetupWithFixture = (flags, cmd) => {
const projectRootURL = new URL('./fixtures/astro-basic/', import.meta.url);
return cliServerLogSetup(['--root', fileURLToPath(projectRootURL), ...flags], cmd);
};
// ... (333 more lines)
Domain
Subdomains
Functions
Dependencies
- cli
- cliServerLogSetup
- loadFixture
- node:child_process
- node:fs
- node:net
- node:path
- node:stream
- node:test
- node:url
- node:util
- parseCliDevStart
- strict
- test-utils.js
Source
Frequently Asked Questions
What does cli.test.js do?
cli.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 cli.test.js?
cli.test.js defines 1 function(s): readFromClipboard.
What does cli.test.js depend on?
cli.test.js imports 14 module(s): cli, cliServerLogSetup, loadFixture, node:child_process, node:fs, node:net, node:path, node:stream, and 6 more.
Where is cli.test.js in the architecture?
cli.test.js is located at packages/astro/test/cli.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