mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-31 07:18:59 +02:00
refactor: unify error handling behavior (#6755)
* refactor: unify error handling behavior * revert * normalize paths * test... * change * does this work... * fix... * maybe fix * maybe fix * fix * fix...
This commit is contained in:
parent
dcbf9f644e
commit
f903422617
58 changed files with 1123 additions and 299 deletions
|
@ -73,8 +73,8 @@ describe('docsVersion', () => {
|
|||
DEFAULT_PLUGIN_ID,
|
||||
DEFAULT_OPTIONS,
|
||||
),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"[docs]: invalid version tag specified! Do not include slash (/) or backslash (\\\\). Try something like: 1.0.0."`,
|
||||
).rejects.toThrowError(
|
||||
'[docs]: invalid version tag specified! Do not include slash (/) or backslash (\\). Try something like: 1.0.0.',
|
||||
);
|
||||
await expect(() =>
|
||||
cliDocsVersionCommand(
|
||||
|
@ -83,8 +83,8 @@ describe('docsVersion', () => {
|
|||
DEFAULT_PLUGIN_ID,
|
||||
DEFAULT_OPTIONS,
|
||||
),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"[docs]: invalid version tag specified! Do not include slash (/) or backslash (\\\\). Try something like: 1.0.0."`,
|
||||
).rejects.toThrowError(
|
||||
'[docs]: invalid version tag specified! Do not include slash (/) or backslash (\\). Try something like: 1.0.0.',
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -51,9 +51,9 @@ function testField(params: {
|
|||
)}`,
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
} catch (err) {
|
||||
// eslint-disable-next-line jest/no-conditional-expect
|
||||
expect(e.message).toMatch(new RegExp(escapeStringRegexp(message)));
|
||||
expect(err.message).toMatch(new RegExp(escapeStringRegexp(message)));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -123,15 +123,13 @@ function createTestUtils({
|
|||
async function generateNavigation(
|
||||
docFiles: DocFile[],
|
||||
): Promise<[DocNavLink | undefined, DocNavLink | undefined][]> {
|
||||
const rawDocs = await Promise.all(
|
||||
docFiles.map((docFile) =>
|
||||
processDocMetadata({
|
||||
docFile,
|
||||
versionMetadata,
|
||||
context,
|
||||
options,
|
||||
}),
|
||||
),
|
||||
const rawDocs = docFiles.map((docFile) =>
|
||||
processDocMetadata({
|
||||
docFile,
|
||||
versionMetadata,
|
||||
context,
|
||||
options,
|
||||
}),
|
||||
);
|
||||
const sidebars = await loadSidebars(versionMetadata.sidebarFilePath, {
|
||||
sidebarItemsGenerator: ({defaultSidebarItemsGenerator, ...args}) =>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue