mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 15:47:23 +02:00
refactor(v2): cleanup console output (#4979)
* refactor(v2): cleanup console output * fix jest issue Co-authored-by: slorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
8501db78a1
commit
41d9288e3d
86 changed files with 382 additions and 339 deletions
|
@ -31,7 +31,7 @@ describe('validateFrontMatter', () => {
|
|||
validateFrontMatter(frontMatter, schema),
|
||||
).toThrowErrorMatchingInlineSnapshot(`"\\"test\\" must be a string"`);
|
||||
expect(consoleError).toHaveBeenCalledWith(
|
||||
expect.stringContaining('The following FrontMatter'),
|
||||
expect.stringContaining('The following frontmatter'),
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -50,5 +50,5 @@ export const PathnameSchema = Joi.string()
|
|||
}
|
||||
})
|
||||
.message(
|
||||
'{{#label}} is not a valid pathname. Pathname should start with / and not contain any domain or query string',
|
||||
'{{#label}} is not a valid pathname. Pathname should start with slash and not contain any domain or query string.',
|
||||
);
|
||||
|
|
|
@ -20,14 +20,14 @@ export const isValidationDisabledEscapeHatch =
|
|||
if (isValidationDisabledEscapeHatch) {
|
||||
console.error(
|
||||
chalk.red(
|
||||
'You should avoid using DISABLE_DOCUSAURUS_VALIDATION escape hatch, this will be removed',
|
||||
'You should avoid using DISABLE_DOCUSAURUS_VALIDATION escape hatch, this will be removed.',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export const logValidationBugReportHint = (): void => {
|
||||
console.log(
|
||||
`\n${chalk.red('A validation error occured.')}${chalk.cyanBright(
|
||||
`\n${chalk.red('A validation error occurred.')}${chalk.cyanBright(
|
||||
'\nThe validation system was added recently to Docusaurus as an attempt to avoid user configuration errors.' +
|
||||
'\nWe may have made some mistakes.' +
|
||||
'\nIf you think your configuration is valid and should keep working, please open a bug report.',
|
||||
|
@ -141,7 +141,7 @@ export function validateFrontMatter<T>(
|
|||
|
||||
console.error(
|
||||
chalk.red(
|
||||
`The following FrontMatter:\n${chalk.yellow(
|
||||
`The following frontmatter:\n${chalk.yellow(
|
||||
frontMatterString,
|
||||
)}\ncontains invalid values for field(s): ${invalidFields}.\n${errorMessages}\n`,
|
||||
),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue