[ci] format
This commit is contained in:
parent
5821323285
commit
f224c539c8
2 changed files with 42 additions and 35 deletions
|
@ -376,7 +376,8 @@ export function createRelativeSchema(cmd: string, fileProtocolRoot: string) {
|
|||
.optional()
|
||||
.default({})
|
||||
),
|
||||
}).transform((config) => {
|
||||
})
|
||||
.transform((config) => {
|
||||
// If the user changed outDir but not build.server, build.config, adjust so those
|
||||
// are relative to the outDir, as is the expected default.
|
||||
if (
|
||||
|
@ -410,8 +411,10 @@ A future version of Astro will stop using the site pathname when producing <link
|
|||
}
|
||||
|
||||
return config;
|
||||
}).refine((obj) => !obj.outDir.toString().startsWith(obj.publicDir.toString()), {
|
||||
message: '`outDir` must not be placed inside `publicDir` to prevent an infinite loop. Please adjust the directory configuration and try again'
|
||||
})
|
||||
.refine((obj) => !obj.outDir.toString().startsWith(obj.publicDir.toString()), {
|
||||
message:
|
||||
'`outDir` must not be placed inside `publicDir` to prevent an infinite loop. Please adjust the directory configuration and try again',
|
||||
});
|
||||
|
||||
return AstroConfigRelativeSchema;
|
||||
|
|
|
@ -69,9 +69,13 @@ describe('Config Validation', () => {
|
|||
expect(configError).to.be.not.instanceOf(Error);
|
||||
});
|
||||
it('Error when outDir is placed within publicDir', async () => {
|
||||
const configError = await validateConfig({ outDir: './public/dist' }, process.cwd()).catch((err) => err);
|
||||
const configError = await validateConfig({ outDir: './public/dist' }, process.cwd()).catch(
|
||||
(err) => err
|
||||
);
|
||||
expect(configError instanceof z.ZodError).to.equal(true);
|
||||
expect(configError.errors[0].message).to.equal('`outDir` must not be placed inside `publicDir` to prevent an infinite loop. \
|
||||
Please adjust the directory configuration and try again')
|
||||
expect(configError.errors[0].message).to.equal(
|
||||
'`outDir` must not be placed inside `publicDir` to prevent an infinite loop. \
|
||||
Please adjust the directory configuration and try again'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue