mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-30 06:50:36 +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
|
@ -44,8 +44,10 @@ function getDocById(version: LoadedVersion, unversionedId: string) {
|
|||
const doc = findDocById(version, unversionedId);
|
||||
if (!doc) {
|
||||
throw new Error(
|
||||
`No doc found with id=${unversionedId} in version ${version.versionName}.
|
||||
Available ids=\n- ${version.docs.map((d) => d.unversionedId).join('\n- ')}`,
|
||||
`No doc found with id "${unversionedId}" in version ${
|
||||
version.versionName
|
||||
}.
|
||||
Available ids are:\n- ${version.docs.map((d) => d.unversionedId).join('\n- ')}`,
|
||||
);
|
||||
}
|
||||
return doc;
|
||||
|
@ -85,7 +87,7 @@ const createFakeActions = (contentDir: string) => {
|
|||
key.startsWith(prefix),
|
||||
);
|
||||
if (!entry) {
|
||||
throw new Error(`No created entry found for prefix=[${prefix}]
|
||||
throw new Error(`No created entry found for prefix "${prefix}".
|
||||
Entries created:
|
||||
- ${Object.keys(dataContainer).join('\n- ')}
|
||||
`);
|
||||
|
@ -151,8 +153,8 @@ describe('sidebar', () => {
|
|||
);
|
||||
await plugin.loadContent!();
|
||||
}).rejects.toThrowErrorMatchingInlineSnapshot(`
|
||||
"The path to the sidebar file does not exist at [wrong-path-sidebar.json].
|
||||
Please set the docs [sidebarPath] field in your config file to:
|
||||
"The path to the sidebar file does not exist at \\"wrong-path-sidebar.json\\".
|
||||
Please set the docs \\"sidebarPath\\" field in your config file to:
|
||||
- a sidebars path that exists
|
||||
- false: to disable the sidebar
|
||||
- undefined: for Docusaurus generates it automatically"
|
||||
|
@ -217,7 +219,7 @@ describe('empty/no docs website', () => {
|
|||
await expect(
|
||||
plugin.loadContent!(),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"Docs version current has no docs! At least one doc should exist at path=[docs]"`,
|
||||
`"Docs version \\"current\\" has no docs! At least one doc should exist at \\"docs\\"."`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -231,11 +233,11 @@ describe('empty/no docs website', () => {
|
|||
}),
|
||||
),
|
||||
).toThrowError(
|
||||
`The docs folder does not exist for version [current]. A docs folder is expected to be found at ${
|
||||
`The docs folder does not exist for version "current". A docs folder is expected to be found at ${
|
||||
process.platform === 'win32'
|
||||
? 'path\\doesnt\\exist'
|
||||
: 'path/doesnt/exist'
|
||||
}`,
|
||||
}.`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue