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:
Alexey Pyltsyn 2021-06-16 12:37:28 +03:00 committed by GitHub
parent 8501db78a1
commit 41d9288e3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
86 changed files with 382 additions and 339 deletions

View file

@ -2,7 +2,7 @@
exports[`transformImage plugin fail if image does not exist 1`] = `"Image packages/docusaurus-mdx-loader/src/remark/transformImage/__tests__/fixtures/img/doesNotExist.png used in packages/docusaurus-mdx-loader/src/remark/transformImage/__tests__/fixtures/fail.md not found."`;
exports[`transformImage plugin fail if image url is absent 1`] = `"Markdown image url is mandatory. filePath=packages/docusaurus-mdx-loader/src/remark/transformImage/__tests__/fixtures/noUrl.md"`;
exports[`transformImage plugin fail if image url is absent 1`] = `"Markdown image URL is mandatory in \\"packages/docusaurus-mdx-loader/src/remark/transformImage/__tests__/fixtures/noUrl.md\\" file"`;
exports[`transformImage plugin pathname protocol 1`] = `
"![img](/img/unchecked.png)

View file

@ -57,9 +57,9 @@ async function ensureImageFileExist(imagePath, sourceFilePath) {
async function processImageNode(node, {filePath, staticDir}) {
if (!node.url) {
throw new Error(
`Markdown image url is mandatory. filePath=${toMessageRelativeFilePath(
`Markdown image URL is mandatory in "${toMessageRelativeFilePath(
filePath,
)}`,
)}" file`,
);
}

View file

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`transformAsset plugin fail if asset url is absent 1`] = `"Markdown link url is mandatory. filePath=packages/docusaurus-mdx-loader/src/remark/transformLinks/__tests__/fixtures/noUrl.md, title=asset, line=1"`;
exports[`transformAsset plugin fail if asset url is absent 1`] = `"Markdown link URL is mandatory in \\"packages/docusaurus-mdx-loader/src/remark/transformLinks/__tests__/fixtures/noUrl.md\\" file (title: asset, line: 1)."`;
exports[`transformAsset plugin pathname protocol 1`] = `
"[asset](pathname:///asset/unchecked.pdf)

View file

@ -111,9 +111,9 @@ async function processLinkNode({node, _index, _parent, filePath, staticDir}) {
const line =
(node.position && node.position.start && node.position.start.line) || '?';
throw new Error(
`Markdown link url is mandatory. filePath=${toMessageRelativeFilePath(
`Markdown link URL is mandatory in "${toMessageRelativeFilePath(
filePath,
)}, title=${title}, line=${line}`,
)}" file (title: ${title}, line: ${line}).`,
);
}