[ci] format
This commit is contained in:
parent
25cc9218f8
commit
aa8fb4af51
3 changed files with 16 additions and 10 deletions
|
@ -379,14 +379,20 @@ export async function loadConfig(configOptions: LoadConfigOptions): Promise<Astr
|
|||
|
||||
if (flags?.config) {
|
||||
userConfigPath = /^\.*\//.test(flags.config) ? flags.config : `./${flags.config}`;
|
||||
userConfigPath = fileURLToPath(new URL(userConfigPath, appendForwardSlash(pathToFileURL(root).toString())));
|
||||
userConfigPath = fileURLToPath(
|
||||
new URL(userConfigPath, appendForwardSlash(pathToFileURL(root).toString()))
|
||||
);
|
||||
}
|
||||
|
||||
// Automatically load config file using Proload
|
||||
// If `userConfigPath` is `undefined`, Proload will search for `astro.config.[cm]?[jt]s`
|
||||
let config;
|
||||
try {
|
||||
config = await load('astro', { mustExist: !!userConfigPath, cwd: root, filePath: userConfigPath });
|
||||
config = await load('astro', {
|
||||
mustExist: !!userConfigPath,
|
||||
cwd: root,
|
||||
filePath: userConfigPath,
|
||||
});
|
||||
} catch (err) {
|
||||
if (err instanceof ProloadError && flags.config) {
|
||||
throw new Error(`Unable to resolve --config "${flags.config}"! Does the file exist?`);
|
||||
|
|
|
@ -78,7 +78,7 @@ describe('config', () => {
|
|||
const localURL = new URL(local);
|
||||
expect(localURL.port).to.equal('8080');
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
describe('relative path with leading ./', () => {
|
||||
it('can be passed via relative --config', async () => {
|
||||
|
@ -94,7 +94,7 @@ describe('config', () => {
|
|||
const localURL = new URL(local);
|
||||
expect(localURL.port).to.equal('8080');
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
describe('incorrect path', () => {
|
||||
it('fails and exits when config does not exist', async () => {
|
||||
|
@ -113,10 +113,10 @@ describe('config', () => {
|
|||
exit = 1;
|
||||
}
|
||||
}
|
||||
|
||||
expect(exit).to.equal(1, "Throws helpful error message when --config does not exist");
|
||||
|
||||
expect(exit).to.equal(1, 'Throws helpful error message when --config does not exist');
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
describe('port', () => {
|
||||
it('can be specified in astro.config.mjs', async () => {
|
||||
|
|
|
@ -171,7 +171,7 @@ export async function parseCliDevStart(proc) {
|
|||
if (stderr) {
|
||||
throw new Error(stderr);
|
||||
}
|
||||
|
||||
|
||||
const messages = stdout
|
||||
.split('\n')
|
||||
.filter((ln) => !!ln.trim())
|
||||
|
@ -185,8 +185,8 @@ export async function cliServerLogSetup(flags = [], cmd = 'dev') {
|
|||
|
||||
const { messages } = await parseCliDevStart(proc);
|
||||
|
||||
const local = messages.find(msg => msg.includes('Local'))?.replace(/Local\s*/g, '');
|
||||
const network = messages.find(msg => msg.includes('Network'))?.replace(/Network\s*/g, '');
|
||||
const local = messages.find((msg) => msg.includes('Local'))?.replace(/Local\s*/g, '');
|
||||
const network = messages.find((msg) => msg.includes('Network'))?.replace(/Network\s*/g, '');
|
||||
|
||||
return { local, network };
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue