diff --git a/packages/astro/test/config-validate.test.js b/packages/astro/test/config-validate.test.js index 3c9bdde36..7853db6b1 100644 --- a/packages/astro/test/config-validate.test.js +++ b/packages/astro/test/config-validate.test.js @@ -7,36 +7,42 @@ import { formatConfigError, validateConfig } from '#astro/config'; const ConfigValidate = suite('Config Validation'); ConfigValidate('empty user config is valid', async (context) => { - const configError = await validateConfig({}, process.cwd()).catch(err => err); + const configError = await validateConfig({}, process.cwd()).catch((err) => err); assert.ok(!(configError instanceof Error)); }); ConfigValidate('Zod errors are returned when invalid config is used', async (context) => { - const configError = await validateConfig({buildOptions: {sitemap: 42}}, process.cwd()).catch(err => err); + const configError = await validateConfig({ buildOptions: { sitemap: 42 } }, process.cwd()).catch((err) => err); assert.ok(configError instanceof z.ZodError); }); ConfigValidate('A validation error can be formatted correctly', async (context) => { - const configError = await validateConfig({buildOptions: {sitemap: 42}}, process.cwd()).catch(err => err); + const configError = await validateConfig({ buildOptions: { sitemap: 42 } }, process.cwd()).catch((err) => err); assert.ok(configError instanceof z.ZodError); const formattedError = stripAnsi(formatConfigError(configError)); - assert.equal(formattedError, `[config] Astro found issue(s) with your configuration: - ! buildOptions.sitemap Expected boolean, received number.`); + assert.equal( + formattedError, + `[config] Astro found issue(s) with your configuration: + ! buildOptions.sitemap Expected boolean, received number.` + ); }); ConfigValidate('Multiple validation errors can be formatted correctly', async (context) => { const veryBadConfig = { renderers: [42], - buildOptions: {pageUrlFormat: 'invalid'}, + buildOptions: { pageUrlFormat: 'invalid' }, pages: {}, }; - const configError = await validateConfig(veryBadConfig, process.cwd()).catch(err => err); + const configError = await validateConfig(veryBadConfig, process.cwd()).catch((err) => err); assert.ok(configError instanceof z.ZodError); const formattedError = stripAnsi(formatConfigError(configError)); - assert.equal(formattedError, `[config] Astro found issue(s) with your configuration: + assert.equal( + formattedError, + `[config] Astro found issue(s) with your configuration: ! pages Expected string, received object. ! renderers.0 Expected string, received number. - ! buildOptions.pageUrlFormat Invalid input.`); + ! buildOptions.pageUrlFormat Invalid input.` + ); }); ConfigValidate.run();