config-server.test.js — astro Source File
Architecture documentation for config-server.test.js, a javascript file in the astro codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR d8bfb9b3_b01f_1611_1518_f2b56ead7d99["config-server.test.js"] 43017524_8b6e_2800_1c5c_1005a81d974b["../../../dist/cli/flags.js"] d8bfb9b3_b01f_1611_1518_f2b56ead7d99 --> 43017524_8b6e_2800_1c5c_1005a81d974b 011fcd63_bba9_72a2_e9be_9bc0a8c48876["../../dist/core/config/index.js"] d8bfb9b3_b01f_1611_1518_f2b56ead7d99 --> 011fcd63_bba9_72a2_e9be_9bc0a8c48876 e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"] d8bfb9b3_b01f_1611_1518_f2b56ead7d99 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] d8bfb9b3_b01f_1611_1518_f2b56ead7d99 --> 6b0635f9_51ea_77aa_767b_7857878e98a6 d9a92db9_c95e_9165_13ac_24b3d859d946["node:url"] d8bfb9b3_b01f_1611_1518_f2b56ead7d99 --> d9a92db9_c95e_9165_13ac_24b3d859d946 style d8bfb9b3_b01f_1611_1518_f2b56ead7d99 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import * as assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { fileURLToPath } from 'node:url';
import { flagsToAstroInlineConfig } from '../../../dist/cli/flags.js';
import { resolveConfig } from '../../../dist/core/config/index.js';
const cwd = fileURLToPath(new URL('../../fixtures/config-host/', import.meta.url));
describe('config.server', () => {
function resolveConfigWithFlags(flags) {
return resolveConfig(
flagsToAstroInlineConfig({
root: cwd,
...flags,
}),
'dev',
);
}
describe('host', () => {
it('can be specified via --host flag', async () => {
const projectRootURL = new URL('../../fixtures/astro-basic/', import.meta.url);
const { astroConfig } = await resolveConfigWithFlags({
root: fileURLToPath(projectRootURL),
host: true,
});
assert.equal(astroConfig.server.host, true);
});
});
describe('config', () => {
describe('relative path', () => {
it('can be passed via relative --config', async () => {
const projectRootURL = new URL('../../fixtures/astro-basic/', import.meta.url);
const configFileURL = 'my-config.mjs';
const { astroConfig } = await resolveConfigWithFlags({
root: fileURLToPath(projectRootURL),
config: configFileURL,
});
assert.equal(astroConfig.server.port, 8080);
});
});
describe('relative path with leading ./', () => {
it('can be passed via relative --config', async () => {
const projectRootURL = new URL('../../fixtures/astro-basic/', import.meta.url);
const configFileURL = './my-config.mjs';
const { astroConfig } = await resolveConfigWithFlags({
root: fileURLToPath(projectRootURL),
config: configFileURL,
});
assert.equal(astroConfig.server.port, 8080);
});
});
describe('incorrect path', () => {
it('fails and exits when config does not exist', async () => {
const projectRootURL = new URL('../../fixtures/astro-basic/', import.meta.url);
const configFileURL = './does-not-exist.mjs';
try {
await resolveConfigWithFlags({
root: fileURLToPath(projectRootURL),
config: configFileURL,
});
assert.equal(false, true, 'this should not have resolved');
} catch (err) {
assert.equal(err.message.includes('Unable to resolve'), true);
}
});
});
});
});
Domain
Dependencies
- ../../../dist/cli/flags.js
- ../../dist/core/config/index.js
- node:test
- node:url
- strict
Source
Frequently Asked Questions
What does config-server.test.js do?
config-server.test.js is a source file in the astro codebase, written in javascript. It belongs to the IntegrationAdapters domain.
What does config-server.test.js depend on?
config-server.test.js imports 5 module(s): ../../../dist/cli/flags.js, ../../dist/core/config/index.js, node:test, node:url, strict.
Where is config-server.test.js in the architecture?
config-server.test.js is located at packages/astro/test/units/config/config-server.test.js (domain: IntegrationAdapters, directory: packages/astro/test/units/config).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free