mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-29 18:27:56 +02:00
chore: disable string escaping in snapshots (#7131)
This commit is contained in:
parent
4134ebb3fb
commit
9145ae88cc
60 changed files with 1881 additions and 1884 deletions
|
@ -69,6 +69,7 @@ export default {
|
|||
'jest-serializer-react-helmet-async',
|
||||
],
|
||||
snapshotFormat: {
|
||||
escapeString: false,
|
||||
printBasicPrototype: false,
|
||||
},
|
||||
};
|
||||
|
|
2
jest/snapshotPathNormalizer.ts
vendored
2
jest/snapshotPathNormalizer.ts
vendored
|
@ -10,6 +10,7 @@
|
|||
|
||||
import _ from 'lodash';
|
||||
import {escapePath} from '@docusaurus/utils';
|
||||
import stripAnsi from 'strip-ansi';
|
||||
import {version} from '@docusaurus/core/package.json';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
|
@ -76,6 +77,7 @@ function normalizePaths<T>(value: T): T {
|
|||
const homeRealRelativeToTemp = path.relative(tempDir, homeDirReal);
|
||||
|
||||
const runner: ((val: string) => string)[] = [
|
||||
(val) => (val.includes('keepAnsi') ? val : stripAnsi(val)),
|
||||
// Replace process.cwd with <PROJECT_ROOT>
|
||||
(val) => val.split(cwdReal).join('<PROJECT_ROOT>'),
|
||||
(val) => val.split(cwd).join('<PROJECT_ROOT>'),
|
||||
|
|
|
@ -108,6 +108,7 @@
|
|||
"remark-parse": "^8.0.2",
|
||||
"rimraf": "^3.0.2",
|
||||
"sharp": "^0.30.3",
|
||||
"strip-ansi": "^6.0.1",
|
||||
"stylelint": "^14.6.1",
|
||||
"stylelint-config-prettier": "^9.0.3",
|
||||
"stylelint-config-standard": "^25.0.0",
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
exports[`error prints objects 1`] = `
|
||||
[
|
||||
[
|
||||
"[31m[1m[ERROR][22m {\\"a\\":1}[39m",
|
||||
"[ERROR] {"a":1}",
|
||||
],
|
||||
[
|
||||
"[31m[1m[ERROR][22m undefined[39m",
|
||||
"[ERROR] undefined",
|
||||
],
|
||||
[
|
||||
"[31m[1m[ERROR][22m 1,2,3[39m",
|
||||
"[ERROR] 1,2,3",
|
||||
],
|
||||
[
|
||||
"[31m[1m[ERROR][22m Sat Nov 13 2021 00:00:00 GMT+0000 (Coordinated Universal Time)[39m",
|
||||
"[ERROR] Sat Nov 13 2021 00:00:00 GMT+0000 (Coordinated Universal Time)",
|
||||
],
|
||||
]
|
||||
`;
|
||||
|
@ -20,16 +20,16 @@ exports[`error prints objects 1`] = `
|
|||
exports[`info prints objects 1`] = `
|
||||
[
|
||||
[
|
||||
"[36m[1m[INFO][22m[39m {\\"a\\":1}",
|
||||
"[INFO] {"a":1}",
|
||||
],
|
||||
[
|
||||
"[36m[1m[INFO][22m[39m undefined",
|
||||
"[INFO] undefined",
|
||||
],
|
||||
[
|
||||
"[36m[1m[INFO][22m[39m 1,2,3",
|
||||
"[INFO] 1,2,3",
|
||||
],
|
||||
[
|
||||
"[36m[1m[INFO][22m[39m Sat Nov 13 2021 00:00:00 GMT+0000 (Coordinated Universal Time)",
|
||||
"[INFO] Sat Nov 13 2021 00:00:00 GMT+0000 (Coordinated Universal Time)",
|
||||
],
|
||||
]
|
||||
`;
|
||||
|
@ -37,16 +37,16 @@ exports[`info prints objects 1`] = `
|
|||
exports[`success prints objects 1`] = `
|
||||
[
|
||||
[
|
||||
"[32m[1m[SUCCESS][22m[39m {\\"a\\":1}",
|
||||
"[SUCCESS] {"a":1}",
|
||||
],
|
||||
[
|
||||
"[32m[1m[SUCCESS][22m[39m undefined",
|
||||
"[SUCCESS] undefined",
|
||||
],
|
||||
[
|
||||
"[32m[1m[SUCCESS][22m[39m 1,2,3",
|
||||
"[SUCCESS] 1,2,3",
|
||||
],
|
||||
[
|
||||
"[32m[1m[SUCCESS][22m[39m Sat Nov 13 2021 00:00:00 GMT+0000 (Coordinated Universal Time)",
|
||||
"[SUCCESS] Sat Nov 13 2021 00:00:00 GMT+0000 (Coordinated Universal Time)",
|
||||
],
|
||||
]
|
||||
`;
|
||||
|
@ -54,16 +54,16 @@ exports[`success prints objects 1`] = `
|
|||
exports[`warn prints objects 1`] = `
|
||||
[
|
||||
[
|
||||
"[33m[1m[WARNING][22m {\\"a\\":1}[39m",
|
||||
"[WARNING] {"a":1}",
|
||||
],
|
||||
[
|
||||
"[33m[1m[WARNING][22m undefined[39m",
|
||||
"[WARNING] undefined",
|
||||
],
|
||||
[
|
||||
"[33m[1m[WARNING][22m 1,2,3[39m",
|
||||
"[WARNING] 1,2,3",
|
||||
],
|
||||
[
|
||||
"[33m[1m[WARNING][22m Sat Nov 13 2021 00:00:00 GMT+0000 (Coordinated Universal Time)[39m",
|
||||
"[WARNING] Sat Nov 13 2021 00:00:00 GMT+0000 (Coordinated Universal Time)",
|
||||
],
|
||||
]
|
||||
`;
|
||||
|
|
|
@ -8,24 +8,25 @@
|
|||
import {jest} from '@jest/globals';
|
||||
import logger from '../index';
|
||||
|
||||
// cSpell:ignore mkeep
|
||||
|
||||
describe('formatters', () => {
|
||||
it('path', () => {
|
||||
// cSpell:ignore mhey
|
||||
expect(logger.path('hey')).toMatchInlineSnapshot(`"[36m[4m\\"hey\\"[24m[39m"`);
|
||||
expect(logger.path('keepAnsi')).toMatchInlineSnapshot(`"[36m[4m"keepAnsi"[24m[39m"`);
|
||||
});
|
||||
it('url', () => {
|
||||
expect(logger.url('https://docusaurus.io/')).toMatchInlineSnapshot(
|
||||
`"[36m[4mhttps://docusaurus.io/[24m[39m"`,
|
||||
expect(logger.url('https://docusaurus.io/keepAnsi')).toMatchInlineSnapshot(
|
||||
`"[36m[4mhttps://docusaurus.io/keepAnsi[24m[39m"`,
|
||||
);
|
||||
});
|
||||
it('id', () => {
|
||||
expect(logger.name('hey')).toMatchInlineSnapshot(`"[34m[1mhey[22m[39m"`);
|
||||
expect(logger.name('keepAnsi')).toMatchInlineSnapshot(`"[34m[1mkeepAnsi[22m[39m"`);
|
||||
});
|
||||
it('code', () => {
|
||||
expect(logger.code('hey')).toMatchInlineSnapshot(`"[36m\`hey\`[39m"`);
|
||||
expect(logger.code('keepAnsi')).toMatchInlineSnapshot(`"[36m\`keepAnsi\`[39m"`);
|
||||
});
|
||||
it('subdue', () => {
|
||||
expect(logger.subdue('hey')).toMatchInlineSnapshot(`"[90mhey[39m"`);
|
||||
expect(logger.subdue('keepAnsi')).toMatchInlineSnapshot(`"[90mkeepAnsi[39m"`);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -33,9 +34,10 @@ describe('interpolate', () => {
|
|||
it('formats text with variables & arrays', () => {
|
||||
const name = 'Josh';
|
||||
const items = [1, 'hi', 'Hmmm'];
|
||||
expect(logger.interpolate`Hello ${name}! Here are your goodies:${items}`)
|
||||
.toMatchInlineSnapshot(`
|
||||
"Hello Josh! Here are your goodies:
|
||||
expect(
|
||||
logger.interpolate`(keepAnsi) Hello ${name}! Here are your goodies:${items}`,
|
||||
).toMatchInlineSnapshot(`
|
||||
"(keepAnsi) Hello Josh! Here are your goodies:
|
||||
- 1
|
||||
- hi
|
||||
- Hmmm"
|
||||
|
@ -43,20 +45,20 @@ describe('interpolate', () => {
|
|||
});
|
||||
it('recognizes valid flags', () => {
|
||||
expect(
|
||||
logger.interpolate`The package at path=${'packages/docusaurus'} has number=${10} files. name=${'Babel'} is exported here subdue=${'(as a preset)'} that you can with code=${"require.resolve('@docusaurus/core/lib/babel/preset')"}`,
|
||||
logger.interpolate`(keepAnsi) The package at path=${'packages/docusaurus'} has number=${10} files. name=${'Babel'} is exported here subdue=${'(as a preset)'} that you can with code=${"require.resolve('@docusaurus/core/lib/babel/preset')"}`,
|
||||
).toMatchInlineSnapshot(
|
||||
`"The package at [36m[4m\\"packages/docusaurus\\"[24m[39m has [33m10[39m files. [34m[1mBabel[22m[39m is exported here [90m(as a preset)[39m that you can with [36m\`require.resolve('@docusaurus/core/lib/babel/preset')\`[39m"`,
|
||||
`"(keepAnsi) The package at [36m[4m"packages/docusaurus"[24m[39m has [33m10[39m files. [34m[1mBabel[22m[39m is exported here [90m(as a preset)[39m that you can with [36m\`require.resolve('@docusaurus/core/lib/babel/preset')\`[39m"`,
|
||||
);
|
||||
});
|
||||
it('interpolates arrays with flags', () => {
|
||||
expect(
|
||||
logger.interpolate`The following commands are available:code=${[
|
||||
logger.interpolate`(keepAnsi) The following commands are available:code=${[
|
||||
'docusaurus start',
|
||||
'docusaurus build',
|
||||
'docusaurus deploy',
|
||||
]}`,
|
||||
).toMatchInlineSnapshot(`
|
||||
"The following commands are available:
|
||||
"(keepAnsi) The following commands are available:
|
||||
- [36m\`docusaurus start\`[39m
|
||||
- [36m\`docusaurus build\`[39m
|
||||
- [36m\`docusaurus deploy\`[39m"
|
||||
|
@ -64,15 +66,15 @@ describe('interpolate', () => {
|
|||
});
|
||||
it('prints detached flags as-is', () => {
|
||||
expect(
|
||||
logger.interpolate`You can use placeholders like code= ${'and it will'} be replaced with the succeeding arguments`,
|
||||
logger.interpolate`(keepAnsi) You can use placeholders like code= ${'and it will'} be replaced with the succeeding arguments`,
|
||||
).toMatchInlineSnapshot(
|
||||
`"You can use placeholders like code= and it will be replaced with the succeeding arguments"`,
|
||||
`"(keepAnsi) You can use placeholders like code= and it will be replaced with the succeeding arguments"`,
|
||||
);
|
||||
});
|
||||
it('throws with bad flags', () => {
|
||||
expect(
|
||||
() =>
|
||||
logger.interpolate`I mistyped this: cde=${'this code'} and I will be damned`,
|
||||
logger.interpolate`(keepAnsi) I mistyped this: cde=${'this code'} and I will be damned`,
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Bad Docusaurus logging message. This is likely an internal bug, please report it."`,
|
||||
);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`transformImage plugin does not choke on invalid image 1`] = `
|
||||
"<img alt={\\"invalid image\\"} src={require(\\"!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/invalid.png\\").default} />
|
||||
"<img alt={"invalid image"} src={require("!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/invalid.png").default} />
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -9,7 +9,7 @@ exports[`transformImage plugin fail if image does not exist 1`] = `"Image packag
|
|||
|
||||
exports[`transformImage plugin fail if image relative path does not exist 1`] = `"Image packages/docusaurus-mdx-loader/src/remark/transformImage/__tests__/__fixtures__/notFound.png used in packages/docusaurus-mdx-loader/src/remark/transformImage/__tests__/__fixtures__/fail2.md not found."`;
|
||||
|
||||
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 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`] = `
|
||||
"
|
||||
|
@ -19,29 +19,29 @@ exports[`transformImage plugin pathname protocol 1`] = `
|
|||
exports[`transformImage plugin transform md images to <img /> 1`] = `
|
||||
"
|
||||
|
||||
<img src={require(\\"!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/img.png\\").default} width=\\"200\\" height=\\"200\\" />
|
||||
<img src={require("!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/img.png").default} width="200" height="200" />
|
||||
|
||||
<img alt={\\"img\\"} src={require(\\"!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/img.png\\").default} width=\\"200\\" height=\\"200\\" />
|
||||
<img alt={"img"} src={require("!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/img.png").default} width="200" height="200" />
|
||||
|
||||
<img alt={\\"img from second static folder\\"} src={require(\\"!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static2/img2.png\\").default} width=\\"256\\" height=\\"82\\" />
|
||||
<img alt={"img from second static folder"} src={require("!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static2/img2.png").default} width="256" height="82" />
|
||||
|
||||
<img alt={\\"img from second static folder\\"} src={require(\\"!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static2/img2.png\\").default} width=\\"256\\" height=\\"82\\" />
|
||||
<img alt={"img from second static folder"} src={require("!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static2/img2.png").default} width="256" height="82" />
|
||||
|
||||
<img alt={\\"img with URL encoded chars\\"} src={require(\\"!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static2/img2 copy.png\\").default} width=\\"256\\" height=\\"82\\" />
|
||||
<img alt={"img with URL encoded chars"} src={require("!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static2/img2 copy.png").default} width="256" height="82" />
|
||||
|
||||
<img alt={\\"img\\"} src={require(\\"!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/img.png\\").default} title=\\"Title\\" width=\\"200\\" height=\\"200\\" /> <img alt={\\"img\\"} src={require(\\"!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/img.png\\").default} width=\\"200\\" height=\\"200\\" />
|
||||
<img alt={"img"} src={require("!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/img.png").default} title="Title" width="200" height="200" /> <img alt={"img"} src={require("!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/img.png").default} width="200" height="200" />
|
||||
|
||||
<img alt={\\"img with "quotes"\\"} src={require(\\"!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/img.png\\").default} title=\\"'Quoted' title\\" width=\\"200\\" height=\\"200\\" />
|
||||
<img alt={"img with "quotes""} src={require("!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/img.png").default} title="'Quoted' title" width="200" height="200" />
|
||||
|
||||
<img alt={\\"site alias\\"} src={require(\\"!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/img.png\\").default} width=\\"200\\" height=\\"200\\" />
|
||||
<img alt={"site alias"} src={require("!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/img.png").default} width="200" height="200" />
|
||||
|
||||
<img alt={\\"img with hash\\"} src={require(\\"!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/img.png\\").default + '#light'} width=\\"200\\" height=\\"200\\" />
|
||||
<img alt={\\"img with hash\\"} src={require(\\"!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/img.png\\").default + '#dark'} width=\\"200\\" height=\\"200\\" />
|
||||
<img alt={"img with hash"} src={require("!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/img.png").default + '#light'} width="200" height="200" />
|
||||
<img alt={"img with hash"} src={require("!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/img.png").default + '#dark'} width="200" height="200" />
|
||||
|
||||
<img alt={\\"img with query\\"} src={require(\\"!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/img.png?w=10\\").default} width=\\"200\\" height=\\"200\\" />
|
||||
<img alt={\\"img with query\\"} src={require(\\"!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/img.png?w=10&h=10\\").default} width=\\"200\\" height=\\"200\\" />
|
||||
<img alt={"img with query"} src={require("!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/img.png?w=10").default} width="200" height="200" />
|
||||
<img alt={"img with query"} src={require("!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/img.png?w=10&h=10").default} width="200" height="200" />
|
||||
|
||||
<img alt={\\"img with both\\"} src={require(\\"!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/img.png?w=10&h=10\\").default + '#light'} width=\\"200\\" height=\\"200\\" />
|
||||
<img alt={"img with both"} src={require("!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/img.png?w=10&h=10").default + '#light'} width="200" height="200" />
|
||||
|
||||
## Heading
|
||||
|
||||
|
|
|
@ -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 in \\"packages/docusaurus-mdx-loader/src/remark/transformLinks/__tests__/__fixtures__/noUrl.md\\" file (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 fail if asset with site alias does not exist 1`] = `"Asset packages/docusaurus-mdx-loader/src/remark/transformLinks/__tests__/__fixtures__/foo.pdf used in packages/docusaurus-mdx-loader/src/remark/transformLinks/__tests__/__fixtures__/nonexistentSiteAlias.md not found."`;
|
||||
|
||||
|
@ -12,15 +12,15 @@ exports[`transformAsset plugin pathname protocol 1`] = `
|
|||
exports[`transformAsset plugin transform md links to <a /> 1`] = `
|
||||
"[asset](https://example.com/asset.pdf)
|
||||
|
||||
<a target=\\"_blank\\" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./asset.pdf').default}></a>
|
||||
<a target="_blank" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./asset.pdf').default}></a>
|
||||
|
||||
<a target=\\"_blank\\" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./asset.pdf').default}>asset</a>
|
||||
<a target="_blank" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./asset.pdf').default}>asset</a>
|
||||
|
||||
<a target=\\"_blank\\" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./asset (2).pdf').default}>asset with URL encoded chars</a>
|
||||
<a target="_blank" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./asset (2).pdf').default}>asset with URL encoded chars</a>
|
||||
|
||||
<a target=\\"_blank\\" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./asset.pdf').default + '#page=2'}>asset with hash</a>
|
||||
<a target="_blank" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./asset.pdf').default + '#page=2'}>asset with hash</a>
|
||||
|
||||
<a target=\\"_blank\\" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./asset.pdf').default} title=\\"Title\\">asset</a>
|
||||
<a target="_blank" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./asset.pdf').default} title="Title">asset</a>
|
||||
|
||||
[page](noUrl.md)
|
||||
|
||||
|
@ -34,24 +34,24 @@ exports[`transformAsset plugin transform md links to <a /> 1`] = `
|
|||
|
||||
[assets](/github/!file-loader!/assets.pdf)
|
||||
|
||||
<a target=\\"_blank\\" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./asset.pdf').default}>asset</a>
|
||||
<a target="_blank" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./asset.pdf').default}>asset</a>
|
||||
|
||||
<a target=\\"_blank\\" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./static2/asset2.pdf').default}>asset2</a>
|
||||
<a target="_blank" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./static2/asset2.pdf').default}>asset2</a>
|
||||
|
||||
<a target=\\"_blank\\" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./static/staticAsset.pdf').default}>staticAsset.pdf</a>
|
||||
<a target="_blank" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./static/staticAsset.pdf').default}>staticAsset.pdf</a>
|
||||
|
||||
<a target=\\"_blank\\" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./static/staticAsset.pdf').default}>@site/static/staticAsset.pdf</a>
|
||||
<a target="_blank" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./static/staticAsset.pdf').default}>@site/static/staticAsset.pdf</a>
|
||||
|
||||
<a target=\\"_blank\\" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./static/staticAsset.pdf').default + '#page=2'} title=\\"Title\\">@site/static/staticAsset.pdf</a>
|
||||
<a target="_blank" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./static/staticAsset.pdf').default + '#page=2'} title="Title">@site/static/staticAsset.pdf</a>
|
||||
|
||||
<a target=\\"_blank\\" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./static/staticAsset.pdf').default}>Just staticAsset.pdf</a>, and <a target=\\"_blank\\" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./static/staticAsset.pdf').default}><strong>awesome</strong> staticAsset 2.pdf 'It is really "AWESOME"'</a>, but also <a target=\\"_blank\\" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./static/staticAsset.pdf').default}>coded <code>staticAsset 3.pdf</code></a>
|
||||
<a target="_blank" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./static/staticAsset.pdf').default}>Just staticAsset.pdf</a>, and <a target="_blank" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./static/staticAsset.pdf').default}><strong>awesome</strong> staticAsset 2.pdf 'It is really "AWESOME"'</a>, but also <a target="_blank" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./static/staticAsset.pdf').default}>coded <code>staticAsset 3.pdf</code></a>
|
||||
|
||||
<a target=\\"_blank\\" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./static/staticAssetImage.png').default}><img alt={\\"Clickable Docusaurus logo\\"} src={require(\\"!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/staticAssetImage.png\\").default} width=\\"200\\" height=\\"200\\" /></a>
|
||||
<a target="_blank" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./static/staticAssetImage.png').default}><img alt={"Clickable Docusaurus logo"} src={require("!<PROJECT_ROOT>/node_modules/url-loader/dist/cjs.js?limit=10000&name=assets/images/[name]-[contenthash].[ext]&fallback=<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js!./static/staticAssetImage.png").default} width="200" height="200" /></a>
|
||||
|
||||
<a target=\\"_blank\\" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./asset.pdf').default}><span style={{color: \\"red\\"}}>Stylized link to asset file</span></a>
|
||||
<a target="_blank" href={require('!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./asset.pdf').default}><span style={{color: "red"}}>Stylized link to asset file</span></a>
|
||||
|
||||
<a target=\\"_blank\\" href={require('./data.raw!=!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./data.json').default}>json</a>
|
||||
<a target="_blank" href={require('./data.raw!=!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./data.json').default}>json</a>
|
||||
|
||||
<a target=\\"_blank\\" href={require('./static/static-json.raw!=!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./static/static-json.json').default}>static json</a>
|
||||
<a target="_blank" href={require('./static/static-json.raw!=!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./static/static-json.json').default}>static json</a>
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -17,7 +17,7 @@ text
|
|||
|
||||
import XYZ from 'xyz';
|
||||
|
||||
<XYZ abc=\\"1\\" def={[1, '42', {hello: 'world'}]} style={{color: 'red'}}>
|
||||
<XYZ abc="1" def={[1, '42', {hello: 'world'}]} style={{color: 'red'}}>
|
||||
<span>Test</span>
|
||||
</XYZ>
|
||||
|
||||
|
@ -32,30 +32,30 @@ import Avatar from 'avatar';
|
|||
## Some complex MDX with nested code blocks
|
||||
|
||||
<Tabs
|
||||
defaultValue=\\"bash\\"
|
||||
defaultValue="bash"
|
||||
values={[
|
||||
{ label: 'Bash', value: 'bash' },
|
||||
{ label: 'Windows', value: 'windows' },
|
||||
{ label: 'PowerShell', value: 'powershell' }
|
||||
]}>
|
||||
<TabItem value=\\"bash\\">
|
||||
<TabItem value="bash">
|
||||
|
||||
\`\`\`bash
|
||||
GIT_USER=<GITHUB_USERNAME> yarn deploy
|
||||
\`\`\`
|
||||
|
||||
</TabItem>
|
||||
<TabItem value=\\"windows\\">
|
||||
<TabItem value="windows">
|
||||
|
||||
\`\`\`batch
|
||||
cmd /C \\"set \\"GIT_USER=<GITHUB_USERNAME>\\" && yarn deploy\\"
|
||||
cmd /C "set "GIT_USER=<GITHUB_USERNAME>" && yarn deploy"
|
||||
\`\`\`
|
||||
|
||||
</TabItem>
|
||||
<TabItem value=\\"powershell\\">
|
||||
<TabItem value="powershell">
|
||||
|
||||
\`\`\`powershell
|
||||
cmd /C 'set \\"GIT_USER=<GITHUB_USERNAME>\\" && yarn deploy'
|
||||
cmd /C 'set "GIT_USER=<GITHUB_USERNAME>" && yarn deploy'
|
||||
\`\`\`
|
||||
|
||||
</TabItem>
|
||||
|
@ -64,30 +64,30 @@ cmd /C 'set \\"GIT_USER=<GITHUB_USERNAME>\\" && yarn deploy'
|
|||
## Some complex MDX code block with nested code blocks
|
||||
|
||||
<Tabs
|
||||
defaultValue=\\"bash\\"
|
||||
defaultValue="bash"
|
||||
values={[
|
||||
{ label: 'Bash', value: 'bash' },
|
||||
{ label: 'Windows', value: 'windows' },
|
||||
{ label: 'PowerShell', value: 'powershell' }
|
||||
]}>
|
||||
<TabItem value=\\"bash\\">
|
||||
<TabItem value="bash">
|
||||
|
||||
\`\`\`bash
|
||||
GIT_USER=<GITHUB_USERNAME> yarn deploy
|
||||
\`\`\`
|
||||
|
||||
</TabItem>
|
||||
<TabItem value=\\"windows\\">
|
||||
<TabItem value="windows">
|
||||
|
||||
\`\`\`batch
|
||||
cmd /C \\"set \\"GIT_USER=<GITHUB_USERNAME>\\" && yarn deploy\\"
|
||||
cmd /C "set "GIT_USER=<GITHUB_USERNAME>" && yarn deploy"
|
||||
\`\`\`
|
||||
|
||||
</TabItem>
|
||||
<TabItem value=\\"powershell\\">
|
||||
<TabItem value="powershell">
|
||||
|
||||
\`\`\`powershell
|
||||
cmd /C 'set \\"GIT_USER=<GITHUB_USERNAME>\\" && yarn deploy'
|
||||
cmd /C 'set "GIT_USER=<GITHUB_USERNAME>" && yarn deploy'
|
||||
\`\`\`
|
||||
|
||||
</TabItem>
|
||||
|
@ -421,7 +421,7 @@ exports[`unwrapMdxCodeBlocks remark plugin unwraps the mdx code blocks AST 1`] =
|
|||
},
|
||||
},
|
||||
"type": "jsx",
|
||||
"value": "<XYZ abc=\\"1\\" def={[1, '42', {hello: 'world'}]} style={{color: 'red'}}>
|
||||
"value": "<XYZ abc="1" def={[1, '42', {hello: 'world'}]} style={{color: 'red'}}>
|
||||
<span>Test</span>
|
||||
</XYZ>",
|
||||
},
|
||||
|
@ -551,13 +551,13 @@ exports[`unwrapMdxCodeBlocks remark plugin unwraps the mdx code blocks AST 1`] =
|
|||
},
|
||||
"type": "jsx",
|
||||
"value": "<Tabs
|
||||
defaultValue=\\"bash\\"
|
||||
defaultValue="bash"
|
||||
values={[
|
||||
{ label: 'Bash', value: 'bash' },
|
||||
{ label: 'Windows', value: 'windows' },
|
||||
{ label: 'PowerShell', value: 'powershell' }
|
||||
]}>
|
||||
<TabItem value=\\"bash\\">",
|
||||
<TabItem value="bash">",
|
||||
},
|
||||
{
|
||||
"lang": "bash",
|
||||
|
@ -599,7 +599,7 @@ exports[`unwrapMdxCodeBlocks remark plugin unwraps the mdx code blocks AST 1`] =
|
|||
},
|
||||
"type": "jsx",
|
||||
"value": " </TabItem>
|
||||
<TabItem value=\\"windows\\">",
|
||||
<TabItem value="windows">",
|
||||
},
|
||||
{
|
||||
"lang": null,
|
||||
|
@ -622,7 +622,7 @@ exports[`unwrapMdxCodeBlocks remark plugin unwraps the mdx code blocks AST 1`] =
|
|||
},
|
||||
"type": "code",
|
||||
"value": "\`\`\`batch
|
||||
cmd /C \\"set \\"GIT_USER=<GITHUB_USERNAME>\\" && yarn deploy\\"
|
||||
cmd /C "set "GIT_USER=<GITHUB_USERNAME>" && yarn deploy"
|
||||
\`\`\`",
|
||||
},
|
||||
{
|
||||
|
@ -643,7 +643,7 @@ cmd /C \\"set \\"GIT_USER=<GITHUB_USERNAME>\\" && yarn deploy\\"
|
|||
},
|
||||
"type": "jsx",
|
||||
"value": " </TabItem>
|
||||
<TabItem value=\\"powershell\\">",
|
||||
<TabItem value="powershell">",
|
||||
},
|
||||
{
|
||||
"lang": "powershell",
|
||||
|
@ -665,7 +665,7 @@ cmd /C \\"set \\"GIT_USER=<GITHUB_USERNAME>\\" && yarn deploy\\"
|
|||
},
|
||||
},
|
||||
"type": "code",
|
||||
"value": "cmd /C 'set \\"GIT_USER=<GITHUB_USERNAME>\\" && yarn deploy'",
|
||||
"value": "cmd /C 'set "GIT_USER=<GITHUB_USERNAME>" && yarn deploy'",
|
||||
},
|
||||
{
|
||||
"position": Position {
|
||||
|
@ -772,30 +772,30 @@ cmd /C \\"set \\"GIT_USER=<GITHUB_USERNAME>\\" && yarn deploy\\"
|
|||
},
|
||||
"type": "code",
|
||||
"value": "<Tabs
|
||||
defaultValue=\\"bash\\"
|
||||
defaultValue="bash"
|
||||
values={[
|
||||
{ label: 'Bash', value: 'bash' },
|
||||
{ label: 'Windows', value: 'windows' },
|
||||
{ label: 'PowerShell', value: 'powershell' }
|
||||
]}>
|
||||
<TabItem value=\\"bash\\">
|
||||
<TabItem value="bash">
|
||||
|
||||
\`\`\`bash
|
||||
GIT_USER=<GITHUB_USERNAME> yarn deploy
|
||||
\`\`\`
|
||||
|
||||
</TabItem>
|
||||
<TabItem value=\\"windows\\">
|
||||
<TabItem value="windows">
|
||||
|
||||
\`\`\`batch
|
||||
cmd /C \\"set \\"GIT_USER=<GITHUB_USERNAME>\\" && yarn deploy\\"
|
||||
cmd /C "set "GIT_USER=<GITHUB_USERNAME>" && yarn deploy"
|
||||
\`\`\`
|
||||
|
||||
</TabItem>
|
||||
<TabItem value=\\"powershell\\">
|
||||
<TabItem value="powershell">
|
||||
|
||||
\`\`\`powershell
|
||||
cmd /C 'set \\"GIT_USER=<GITHUB_USERNAME>\\" && yarn deploy'
|
||||
cmd /C 'set "GIT_USER=<GITHUB_USERNAME>" && yarn deploy'
|
||||
\`\`\`
|
||||
|
||||
</TabItem>
|
||||
|
|
|
@ -32,106 +32,106 @@ exports[`migration CLI migrates complex website: write 1`] = `
|
|||
[
|
||||
"<PROJECT_ROOT>/packages/docusaurus-migrate/src/__tests__/__fixtures__/migrated_complex_site/docusaurus.config.js",
|
||||
"module.exports={
|
||||
\\"title\\": \\"Docusaurus\\",
|
||||
\\"tagline\\": \\"Easy to Maintain Open Source Documentation Websites\\",
|
||||
\\"url\\": \\"https://docusaurus.io\\",
|
||||
\\"baseUrl\\": \\"/\\",
|
||||
\\"organizationName\\": \\"facebook\\",
|
||||
\\"projectName\\": \\"docusaurus\\",
|
||||
\\"noIndex\\": false,
|
||||
\\"scripts\\": [
|
||||
\\"https://buttons.github.io/buttons.js\\",
|
||||
\\"https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js\\",
|
||||
\\"/js/code-blocks-buttons.js\\"
|
||||
"title": "Docusaurus",
|
||||
"tagline": "Easy to Maintain Open Source Documentation Websites",
|
||||
"url": "https://docusaurus.io",
|
||||
"baseUrl": "/",
|
||||
"organizationName": "facebook",
|
||||
"projectName": "docusaurus",
|
||||
"noIndex": false,
|
||||
"scripts": [
|
||||
"https://buttons.github.io/buttons.js",
|
||||
"https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js",
|
||||
"/js/code-blocks-buttons.js"
|
||||
],
|
||||
\\"favicon\\": \\"img/docusaurus.ico\\",
|
||||
\\"customFields\\": {
|
||||
\\"users\\": {
|
||||
\\"caption\\": \\"DevSpace\\",
|
||||
\\"image\\": \\"/img/users/devspace.svg\\",
|
||||
\\"infoLink\\": \\"https://devspace.cloud/docs/\\",
|
||||
\\"fbOpenSource\\": false,
|
||||
\\"pinned\\": false
|
||||
"favicon": "img/docusaurus.ico",
|
||||
"customFields": {
|
||||
"users": {
|
||||
"caption": "DevSpace",
|
||||
"image": "/img/users/devspace.svg",
|
||||
"infoLink": "https://devspace.cloud/docs/",
|
||||
"fbOpenSource": false,
|
||||
"pinned": false
|
||||
},
|
||||
\\"translationRecruitingLink\\": \\"https://crowdin.com/project/docusaurus\\",
|
||||
\\"facebookAppId\\": \\"199138890728411\\"
|
||||
"translationRecruitingLink": "https://crowdin.com/project/docusaurus",
|
||||
"facebookAppId": "199138890728411"
|
||||
},
|
||||
\\"onBrokenLinks\\": \\"log\\",
|
||||
\\"onBrokenMarkdownLinks\\": \\"log\\",
|
||||
\\"presets\\": [
|
||||
"onBrokenLinks": "log",
|
||||
"onBrokenMarkdownLinks": "log",
|
||||
"presets": [
|
||||
[
|
||||
\\"@docusaurus/preset-classic\\",
|
||||
"@docusaurus/preset-classic",
|
||||
{
|
||||
\\"docs\\": {
|
||||
\\"showLastUpdateAuthor\\": true,
|
||||
\\"showLastUpdateTime\\": true,
|
||||
\\"editUrl\\": \\"https://github.com/facebook/docusaurus/edit/main/docs/\\"
|
||||
"docs": {
|
||||
"showLastUpdateAuthor": true,
|
||||
"showLastUpdateTime": true,
|
||||
"editUrl": "https://github.com/facebook/docusaurus/edit/main/docs/"
|
||||
},
|
||||
\\"blog\\": {},
|
||||
\\"theme\\": {
|
||||
\\"customCss\\": \\"../complex_website/src/css/customTheme.css\\"
|
||||
"blog": {},
|
||||
"theme": {
|
||||
"customCss": "../complex_website/src/css/customTheme.css"
|
||||
},
|
||||
\\"googleAnalytics\\": {
|
||||
\\"trackingID\\": \\"UA-44373548-31\\"
|
||||
"googleAnalytics": {
|
||||
"trackingID": "UA-44373548-31"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
\\"plugins\\": [],
|
||||
\\"themeConfig\\": {
|
||||
\\"navbar\\": {
|
||||
\\"title\\": \\"Docusaurus\\",
|
||||
\\"logo\\": {
|
||||
\\"src\\": \\"img/docusaurus.svg\\"
|
||||
"plugins": [],
|
||||
"themeConfig": {
|
||||
"navbar": {
|
||||
"title": "Docusaurus",
|
||||
"logo": {
|
||||
"src": "img/docusaurus.svg"
|
||||
},
|
||||
\\"items\\": [
|
||||
"items": [
|
||||
{
|
||||
\\"to\\": \\"docs/installation\\",
|
||||
\\"label\\": \\"Docs\\",
|
||||
\\"position\\": \\"left\\"
|
||||
"to": "docs/installation",
|
||||
"label": "Docs",
|
||||
"position": "left"
|
||||
},
|
||||
{
|
||||
\\"to\\": \\"docs/tutorial-setup\\",
|
||||
\\"label\\": \\"Tutorial\\",
|
||||
\\"position\\": \\"left\\"
|
||||
"to": "docs/tutorial-setup",
|
||||
"label": "Tutorial",
|
||||
"position": "left"
|
||||
},
|
||||
{
|
||||
\\"to\\": \\"/users\\",
|
||||
\\"label\\": \\"Users\\",
|
||||
\\"position\\": \\"left\\"
|
||||
"to": "/users",
|
||||
"label": "Users",
|
||||
"position": "left"
|
||||
},
|
||||
{
|
||||
\\"href\\": \\"https://github.com/facebook/docusaurus\\",
|
||||
\\"label\\": \\"GitHub\\",
|
||||
\\"position\\": \\"left\\"
|
||||
"href": "https://github.com/facebook/docusaurus",
|
||||
"label": "GitHub",
|
||||
"position": "left"
|
||||
}
|
||||
]
|
||||
},
|
||||
\\"image\\": \\"img/docusaurus.png\\",
|
||||
\\"footer\\": {
|
||||
\\"links\\": [
|
||||
"image": "img/docusaurus.png",
|
||||
"footer": {
|
||||
"links": [
|
||||
{
|
||||
\\"title\\": \\"Community\\",
|
||||
\\"items\\": [
|
||||
"title": "Community",
|
||||
"items": [
|
||||
{
|
||||
\\"label\\": \\"Twitter\\",
|
||||
\\"to\\": \\"https://twitter.com/docusaurus\\"
|
||||
"label": "Twitter",
|
||||
"to": "https://twitter.com/docusaurus"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
\\"copyright\\": \\"Copyright © 2022 Facebook Inc.\\",
|
||||
\\"logo\\": {
|
||||
\\"src\\": \\"img/docusaurus_monochrome.svg\\"
|
||||
"copyright": "Copyright © 2022 Facebook Inc.",
|
||||
"logo": {
|
||||
"src": "img/docusaurus_monochrome.svg"
|
||||
}
|
||||
},
|
||||
\\"algolia\\": {
|
||||
\\"apiKey\\": \\"3eb9507824b8be89e7a199ecaa1a9d2c\\",
|
||||
\\"indexName\\": \\"docusaurus\\",
|
||||
\\"algoliaOptions\\": {
|
||||
\\"facetFilters\\": [
|
||||
\\"language:LANGUAGE\\",
|
||||
\\"version:VERSION\\"
|
||||
"algolia": {
|
||||
"apiKey": "3eb9507824b8be89e7a199ecaa1a9d2c",
|
||||
"indexName": "docusaurus",
|
||||
"algoliaOptions": {
|
||||
"facetFilters": [
|
||||
"language:LANGUAGE",
|
||||
"version:VERSION"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -141,29 +141,29 @@ exports[`migration CLI migrates complex website: write 1`] = `
|
|||
[
|
||||
"<PROJECT_ROOT>/packages/docusaurus-migrate/src/__tests__/__fixtures__/migrated_complex_site/package.json",
|
||||
"{
|
||||
\\"name\\": \\"docusaurus-1-website\\",
|
||||
\\"version\\": \\"2.0.0-alpha.58\\",
|
||||
\\"private\\": true,
|
||||
\\"scripts\\": {
|
||||
\\"start\\": \\"docusaurus start\\",
|
||||
\\"build\\": \\"docusaurus build\\",
|
||||
\\"publish-gh-pages\\": \\"docusaurus-publish\\",
|
||||
\\"examples\\": \\"docusaurus-examples\\",
|
||||
\\"write-translations\\": \\"docusaurus-write-translations\\",
|
||||
\\"docusaurus-version\\": \\"docusaurus-version\\",
|
||||
\\"rename-version\\": \\"docusaurus-rename-version\\",
|
||||
\\"crowdin-upload\\": \\"crowdin --config ../crowdin.yaml upload sources --auto-update -b master\\",
|
||||
\\"crowdin-download\\": \\"crowdin --config ../crowdin.yaml download -b master\\",
|
||||
\\"swizzle\\": \\"docusaurus swizzle\\",
|
||||
\\"deploy\\": \\"docusaurus deploy\\",
|
||||
\\"docusaurus\\": \\"docusaurus\\"
|
||||
"name": "docusaurus-1-website",
|
||||
"version": "2.0.0-alpha.58",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "docusaurus start",
|
||||
"build": "docusaurus build",
|
||||
"publish-gh-pages": "docusaurus-publish",
|
||||
"examples": "docusaurus-examples",
|
||||
"write-translations": "docusaurus-write-translations",
|
||||
"docusaurus-version": "docusaurus-version",
|
||||
"rename-version": "docusaurus-rename-version",
|
||||
"crowdin-upload": "crowdin --config ../crowdin.yaml upload sources --auto-update -b master",
|
||||
"crowdin-download": "crowdin --config ../crowdin.yaml download -b master",
|
||||
"swizzle": "docusaurus swizzle",
|
||||
"deploy": "docusaurus deploy",
|
||||
"docusaurus": "docusaurus"
|
||||
},
|
||||
\\"dependencies\\": {
|
||||
\\"@docusaurus/core\\": \\"<CURRENT_VERSION>\\",
|
||||
\\"@docusaurus/preset-classic\\": \\"<CURRENT_VERSION>\\",
|
||||
\\"clsx\\": \\"^1.1.1\\",
|
||||
\\"react\\": \\"^17.0.2\\",
|
||||
\\"react-dom\\": \\"^17.0.2\\"
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "<CURRENT_VERSION>",
|
||||
"@docusaurus/preset-classic": "<CURRENT_VERSION>",
|
||||
"clsx": "^1.1.1",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2"
|
||||
}
|
||||
}",
|
||||
],
|
||||
|
@ -215,106 +215,106 @@ exports[`migration CLI migrates missing versions: write 1`] = `
|
|||
[
|
||||
"<PROJECT_ROOT>/packages/docusaurus-migrate/src/__tests__/__fixtures__/migrated_missing_version_site/docusaurus.config.js",
|
||||
"module.exports={
|
||||
\\"title\\": \\"Docusaurus\\",
|
||||
\\"tagline\\": \\"Easy to Maintain Open Source Documentation Websites\\",
|
||||
\\"url\\": \\"https://docusaurus.io\\",
|
||||
\\"baseUrl\\": \\"/\\",
|
||||
\\"organizationName\\": \\"facebook\\",
|
||||
\\"projectName\\": \\"docusaurus\\",
|
||||
\\"noIndex\\": false,
|
||||
\\"scripts\\": [
|
||||
\\"https://buttons.github.io/buttons.js\\",
|
||||
\\"https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js\\",
|
||||
\\"/js/code-blocks-buttons.js\\"
|
||||
"title": "Docusaurus",
|
||||
"tagline": "Easy to Maintain Open Source Documentation Websites",
|
||||
"url": "https://docusaurus.io",
|
||||
"baseUrl": "/",
|
||||
"organizationName": "facebook",
|
||||
"projectName": "docusaurus",
|
||||
"noIndex": false,
|
||||
"scripts": [
|
||||
"https://buttons.github.io/buttons.js",
|
||||
"https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js",
|
||||
"/js/code-blocks-buttons.js"
|
||||
],
|
||||
\\"favicon\\": \\"img/docusaurus.ico\\",
|
||||
\\"customFields\\": {
|
||||
\\"users\\": {
|
||||
\\"caption\\": \\"DevSpace\\",
|
||||
\\"image\\": \\"/img/users/devspace.svg\\",
|
||||
\\"infoLink\\": \\"https://devspace.cloud/docs/\\",
|
||||
\\"fbOpenSource\\": false,
|
||||
\\"pinned\\": false
|
||||
"favicon": "img/docusaurus.ico",
|
||||
"customFields": {
|
||||
"users": {
|
||||
"caption": "DevSpace",
|
||||
"image": "/img/users/devspace.svg",
|
||||
"infoLink": "https://devspace.cloud/docs/",
|
||||
"fbOpenSource": false,
|
||||
"pinned": false
|
||||
},
|
||||
\\"translationRecruitingLink\\": \\"https://crowdin.com/project/docusaurus\\",
|
||||
\\"facebookAppId\\": \\"199138890728411\\"
|
||||
"translationRecruitingLink": "https://crowdin.com/project/docusaurus",
|
||||
"facebookAppId": "199138890728411"
|
||||
},
|
||||
\\"onBrokenLinks\\": \\"log\\",
|
||||
\\"onBrokenMarkdownLinks\\": \\"log\\",
|
||||
\\"presets\\": [
|
||||
"onBrokenLinks": "log",
|
||||
"onBrokenMarkdownLinks": "log",
|
||||
"presets": [
|
||||
[
|
||||
\\"@docusaurus/preset-classic\\",
|
||||
"@docusaurus/preset-classic",
|
||||
{
|
||||
\\"docs\\": {
|
||||
\\"showLastUpdateAuthor\\": true,
|
||||
\\"showLastUpdateTime\\": true,
|
||||
\\"editUrl\\": \\"https://github.com/facebook/docusaurus/edit/main/docs/\\"
|
||||
"docs": {
|
||||
"showLastUpdateAuthor": true,
|
||||
"showLastUpdateTime": true,
|
||||
"editUrl": "https://github.com/facebook/docusaurus/edit/main/docs/"
|
||||
},
|
||||
\\"blog\\": {},
|
||||
\\"theme\\": {
|
||||
\\"customCss\\": \\"../missing_version_website/src/css/customTheme.css\\"
|
||||
"blog": {},
|
||||
"theme": {
|
||||
"customCss": "../missing_version_website/src/css/customTheme.css"
|
||||
},
|
||||
\\"googleAnalytics\\": {
|
||||
\\"trackingID\\": \\"UA-44373548-31\\"
|
||||
"googleAnalytics": {
|
||||
"trackingID": "UA-44373548-31"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
\\"plugins\\": [],
|
||||
\\"themeConfig\\": {
|
||||
\\"navbar\\": {
|
||||
\\"title\\": \\"Docusaurus\\",
|
||||
\\"logo\\": {
|
||||
\\"src\\": \\"img/docusaurus.svg\\"
|
||||
"plugins": [],
|
||||
"themeConfig": {
|
||||
"navbar": {
|
||||
"title": "Docusaurus",
|
||||
"logo": {
|
||||
"src": "img/docusaurus.svg"
|
||||
},
|
||||
\\"items\\": [
|
||||
"items": [
|
||||
{
|
||||
\\"to\\": \\"docs/installation\\",
|
||||
\\"label\\": \\"Docs\\",
|
||||
\\"position\\": \\"left\\"
|
||||
"to": "docs/installation",
|
||||
"label": "Docs",
|
||||
"position": "left"
|
||||
},
|
||||
{
|
||||
\\"to\\": \\"docs/tutorial-setup\\",
|
||||
\\"label\\": \\"Tutorial\\",
|
||||
\\"position\\": \\"left\\"
|
||||
"to": "docs/tutorial-setup",
|
||||
"label": "Tutorial",
|
||||
"position": "left"
|
||||
},
|
||||
{
|
||||
\\"to\\": \\"/users\\",
|
||||
\\"label\\": \\"Users\\",
|
||||
\\"position\\": \\"left\\"
|
||||
"to": "/users",
|
||||
"label": "Users",
|
||||
"position": "left"
|
||||
},
|
||||
{
|
||||
\\"href\\": \\"https://github.com/facebook/docusaurus\\",
|
||||
\\"label\\": \\"GitHub\\",
|
||||
\\"position\\": \\"left\\"
|
||||
"href": "https://github.com/facebook/docusaurus",
|
||||
"label": "GitHub",
|
||||
"position": "left"
|
||||
}
|
||||
]
|
||||
},
|
||||
\\"image\\": \\"img/docusaurus.png\\",
|
||||
\\"footer\\": {
|
||||
\\"links\\": [
|
||||
"image": "img/docusaurus.png",
|
||||
"footer": {
|
||||
"links": [
|
||||
{
|
||||
\\"title\\": \\"Community\\",
|
||||
\\"items\\": [
|
||||
"title": "Community",
|
||||
"items": [
|
||||
{
|
||||
\\"label\\": \\"Twitter\\",
|
||||
\\"to\\": \\"https://twitter.com/docusaurus\\"
|
||||
"label": "Twitter",
|
||||
"to": "https://twitter.com/docusaurus"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
\\"copyright\\": \\"Copyright © 2022 Facebook Inc.\\",
|
||||
\\"logo\\": {
|
||||
\\"src\\": \\"img/docusaurus_monochrome.svg\\"
|
||||
"copyright": "Copyright © 2022 Facebook Inc.",
|
||||
"logo": {
|
||||
"src": "img/docusaurus_monochrome.svg"
|
||||
}
|
||||
},
|
||||
\\"algolia\\": {
|
||||
\\"apiKey\\": \\"3eb9507824b8be89e7a199ecaa1a9d2c\\",
|
||||
\\"indexName\\": \\"docusaurus\\",
|
||||
\\"algoliaOptions\\": {
|
||||
\\"facetFilters\\": [
|
||||
\\"language:LANGUAGE\\",
|
||||
\\"version:VERSION\\"
|
||||
"algolia": {
|
||||
"apiKey": "3eb9507824b8be89e7a199ecaa1a9d2c",
|
||||
"indexName": "docusaurus",
|
||||
"algoliaOptions": {
|
||||
"facetFilters": [
|
||||
"language:LANGUAGE",
|
||||
"version:VERSION"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -324,29 +324,29 @@ exports[`migration CLI migrates missing versions: write 1`] = `
|
|||
[
|
||||
"<PROJECT_ROOT>/packages/docusaurus-migrate/src/__tests__/__fixtures__/migrated_missing_version_site/package.json",
|
||||
"{
|
||||
\\"name\\": \\"docusaurus-1-website\\",
|
||||
\\"version\\": \\"2.0.0-alpha.58\\",
|
||||
\\"private\\": true,
|
||||
\\"scripts\\": {
|
||||
\\"start\\": \\"docusaurus start\\",
|
||||
\\"build\\": \\"docusaurus build\\",
|
||||
\\"publish-gh-pages\\": \\"docusaurus-publish\\",
|
||||
\\"examples\\": \\"docusaurus-examples\\",
|
||||
\\"write-translations\\": \\"docusaurus-write-translations\\",
|
||||
\\"docusaurus-version\\": \\"docusaurus-version\\",
|
||||
\\"rename-version\\": \\"docusaurus-rename-version\\",
|
||||
\\"crowdin-upload\\": \\"crowdin --config ../crowdin.yaml upload sources --auto-update -b master\\",
|
||||
\\"crowdin-download\\": \\"crowdin --config ../crowdin.yaml download -b master\\",
|
||||
\\"swizzle\\": \\"docusaurus swizzle\\",
|
||||
\\"deploy\\": \\"docusaurus deploy\\",
|
||||
\\"docusaurus\\": \\"docusaurus\\"
|
||||
"name": "docusaurus-1-website",
|
||||
"version": "2.0.0-alpha.58",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "docusaurus start",
|
||||
"build": "docusaurus build",
|
||||
"publish-gh-pages": "docusaurus-publish",
|
||||
"examples": "docusaurus-examples",
|
||||
"write-translations": "docusaurus-write-translations",
|
||||
"docusaurus-version": "docusaurus-version",
|
||||
"rename-version": "docusaurus-rename-version",
|
||||
"crowdin-upload": "crowdin --config ../crowdin.yaml upload sources --auto-update -b master",
|
||||
"crowdin-download": "crowdin --config ../crowdin.yaml download -b master",
|
||||
"swizzle": "docusaurus swizzle",
|
||||
"deploy": "docusaurus deploy",
|
||||
"docusaurus": "docusaurus"
|
||||
},
|
||||
\\"dependencies\\": {
|
||||
\\"@docusaurus/core\\": \\"<CURRENT_VERSION>\\",
|
||||
\\"@docusaurus/preset-classic\\": \\"<CURRENT_VERSION>\\",
|
||||
\\"clsx\\": \\"^1.1.1\\",
|
||||
\\"react\\": \\"^17.0.2\\",
|
||||
\\"react-dom\\": \\"^17.0.2\\"
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "<CURRENT_VERSION>",
|
||||
"@docusaurus/preset-classic": "<CURRENT_VERSION>",
|
||||
"clsx": "^1.1.1",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2"
|
||||
}
|
||||
}",
|
||||
],
|
||||
|
@ -394,107 +394,107 @@ exports[`migration CLI migrates simple website: write 1`] = `
|
|||
[
|
||||
"<PROJECT_ROOT>/packages/docusaurus-migrate/src/__tests__/__fixtures__/migrated_simple_site/docusaurus.config.js",
|
||||
"module.exports={
|
||||
\\"title\\": \\"Docusaurus\\",
|
||||
\\"tagline\\": \\"Easy to Maintain Open Source Documentation Websites\\",
|
||||
\\"url\\": \\"https://docusaurus.io\\",
|
||||
\\"baseUrl\\": \\"/\\",
|
||||
\\"organizationName\\": \\"facebook\\",
|
||||
\\"projectName\\": \\"docusaurus\\",
|
||||
\\"noIndex\\": false,
|
||||
\\"scripts\\": [
|
||||
\\"https://buttons.github.io/buttons.js\\",
|
||||
\\"https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js\\",
|
||||
\\"/js/code-blocks-buttons.js\\"
|
||||
"title": "Docusaurus",
|
||||
"tagline": "Easy to Maintain Open Source Documentation Websites",
|
||||
"url": "https://docusaurus.io",
|
||||
"baseUrl": "/",
|
||||
"organizationName": "facebook",
|
||||
"projectName": "docusaurus",
|
||||
"noIndex": false,
|
||||
"scripts": [
|
||||
"https://buttons.github.io/buttons.js",
|
||||
"https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js",
|
||||
"/js/code-blocks-buttons.js"
|
||||
],
|
||||
\\"favicon\\": \\"img/docusaurus.ico\\",
|
||||
\\"customFields\\": {
|
||||
\\"users\\": {
|
||||
\\"caption\\": \\"DevSpace\\",
|
||||
\\"image\\": \\"/img/users/devspace.svg\\",
|
||||
\\"infoLink\\": \\"https://devspace.cloud/docs/\\",
|
||||
\\"fbOpenSource\\": false,
|
||||
\\"pinned\\": false
|
||||
"favicon": "img/docusaurus.ico",
|
||||
"customFields": {
|
||||
"users": {
|
||||
"caption": "DevSpace",
|
||||
"image": "/img/users/devspace.svg",
|
||||
"infoLink": "https://devspace.cloud/docs/",
|
||||
"fbOpenSource": false,
|
||||
"pinned": false
|
||||
},
|
||||
\\"translationRecruitingLink\\": \\"https://crowdin.com/project/docusaurus\\",
|
||||
\\"facebookAppId\\": \\"199138890728411\\"
|
||||
"translationRecruitingLink": "https://crowdin.com/project/docusaurus",
|
||||
"facebookAppId": "199138890728411"
|
||||
},
|
||||
\\"onBrokenLinks\\": \\"log\\",
|
||||
\\"onBrokenMarkdownLinks\\": \\"log\\",
|
||||
\\"presets\\": [
|
||||
"onBrokenLinks": "log",
|
||||
"onBrokenMarkdownLinks": "log",
|
||||
"presets": [
|
||||
[
|
||||
\\"@docusaurus/preset-classic\\",
|
||||
"@docusaurus/preset-classic",
|
||||
{
|
||||
\\"docs\\": {
|
||||
\\"showLastUpdateAuthor\\": true,
|
||||
\\"showLastUpdateTime\\": true,
|
||||
\\"editUrl\\": \\"https://github.com/facebook/docusaurus/edit/main/docs/\\",
|
||||
\\"path\\": \\"../simple_website/docs\\"
|
||||
"docs": {
|
||||
"showLastUpdateAuthor": true,
|
||||
"showLastUpdateTime": true,
|
||||
"editUrl": "https://github.com/facebook/docusaurus/edit/main/docs/",
|
||||
"path": "../simple_website/docs"
|
||||
},
|
||||
\\"blog\\": {},
|
||||
\\"theme\\": {
|
||||
\\"customCss\\": \\"../simple_website/src/css/customTheme.css\\"
|
||||
"blog": {},
|
||||
"theme": {
|
||||
"customCss": "../simple_website/src/css/customTheme.css"
|
||||
},
|
||||
\\"googleAnalytics\\": {
|
||||
\\"trackingID\\": \\"UA-44373548-31\\"
|
||||
"googleAnalytics": {
|
||||
"trackingID": "UA-44373548-31"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
\\"plugins\\": [],
|
||||
\\"themeConfig\\": {
|
||||
\\"navbar\\": {
|
||||
\\"title\\": \\"Docusaurus\\",
|
||||
\\"logo\\": {
|
||||
\\"src\\": \\"img/docusaurus.svg\\"
|
||||
"plugins": [],
|
||||
"themeConfig": {
|
||||
"navbar": {
|
||||
"title": "Docusaurus",
|
||||
"logo": {
|
||||
"src": "img/docusaurus.svg"
|
||||
},
|
||||
\\"items\\": [
|
||||
"items": [
|
||||
{
|
||||
\\"to\\": \\"docs/installation\\",
|
||||
\\"label\\": \\"Docs\\",
|
||||
\\"position\\": \\"left\\"
|
||||
"to": "docs/installation",
|
||||
"label": "Docs",
|
||||
"position": "left"
|
||||
},
|
||||
{
|
||||
\\"to\\": \\"docs/tutorial-setup\\",
|
||||
\\"label\\": \\"Tutorial\\",
|
||||
\\"position\\": \\"left\\"
|
||||
"to": "docs/tutorial-setup",
|
||||
"label": "Tutorial",
|
||||
"position": "left"
|
||||
},
|
||||
{
|
||||
\\"to\\": \\"/users\\",
|
||||
\\"label\\": \\"Users\\",
|
||||
\\"position\\": \\"left\\"
|
||||
"to": "/users",
|
||||
"label": "Users",
|
||||
"position": "left"
|
||||
},
|
||||
{
|
||||
\\"href\\": \\"https://github.com/facebook/docusaurus\\",
|
||||
\\"label\\": \\"GitHub\\",
|
||||
\\"position\\": \\"left\\"
|
||||
"href": "https://github.com/facebook/docusaurus",
|
||||
"label": "GitHub",
|
||||
"position": "left"
|
||||
}
|
||||
]
|
||||
},
|
||||
\\"image\\": \\"img/docusaurus.png\\",
|
||||
\\"footer\\": {
|
||||
\\"links\\": [
|
||||
"image": "img/docusaurus.png",
|
||||
"footer": {
|
||||
"links": [
|
||||
{
|
||||
\\"title\\": \\"Community\\",
|
||||
\\"items\\": [
|
||||
"title": "Community",
|
||||
"items": [
|
||||
{
|
||||
\\"label\\": \\"Twitter\\",
|
||||
\\"to\\": \\"https://twitter.com/docusaurus\\"
|
||||
"label": "Twitter",
|
||||
"to": "https://twitter.com/docusaurus"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
\\"copyright\\": \\"Copyright © 2022 Facebook Inc.\\",
|
||||
\\"logo\\": {
|
||||
\\"src\\": \\"img/docusaurus_monochrome.svg\\"
|
||||
"copyright": "Copyright © 2022 Facebook Inc.",
|
||||
"logo": {
|
||||
"src": "img/docusaurus_monochrome.svg"
|
||||
}
|
||||
},
|
||||
\\"algolia\\": {
|
||||
\\"apiKey\\": \\"3eb9507824b8be89e7a199ecaa1a9d2c\\",
|
||||
\\"indexName\\": \\"docusaurus\\",
|
||||
\\"algoliaOptions\\": {
|
||||
\\"facetFilters\\": [
|
||||
\\"language:LANGUAGE\\",
|
||||
\\"version:VERSION\\"
|
||||
"algolia": {
|
||||
"apiKey": "3eb9507824b8be89e7a199ecaa1a9d2c",
|
||||
"indexName": "docusaurus",
|
||||
"algoliaOptions": {
|
||||
"facetFilters": [
|
||||
"language:LANGUAGE",
|
||||
"version:VERSION"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -504,29 +504,29 @@ exports[`migration CLI migrates simple website: write 1`] = `
|
|||
[
|
||||
"<PROJECT_ROOT>/packages/docusaurus-migrate/src/__tests__/__fixtures__/migrated_simple_site/package.json",
|
||||
"{
|
||||
\\"name\\": \\"docusaurus-1-website\\",
|
||||
\\"version\\": \\"2.0.0-alpha.58\\",
|
||||
\\"private\\": true,
|
||||
\\"scripts\\": {
|
||||
\\"start\\": \\"docusaurus start\\",
|
||||
\\"build\\": \\"docusaurus build\\",
|
||||
\\"publish-gh-pages\\": \\"docusaurus-publish\\",
|
||||
\\"examples\\": \\"docusaurus-examples\\",
|
||||
\\"write-translations\\": \\"docusaurus-write-translations\\",
|
||||
\\"docusaurus-version\\": \\"docusaurus-version\\",
|
||||
\\"rename-version\\": \\"docusaurus-rename-version\\",
|
||||
\\"crowdin-upload\\": \\"crowdin --config ../crowdin.yaml upload sources --auto-update -b master\\",
|
||||
\\"crowdin-download\\": \\"crowdin --config ../crowdin.yaml download -b master\\",
|
||||
\\"swizzle\\": \\"docusaurus swizzle\\",
|
||||
\\"deploy\\": \\"docusaurus deploy\\",
|
||||
\\"docusaurus\\": \\"docusaurus\\"
|
||||
"name": "docusaurus-1-website",
|
||||
"version": "2.0.0-alpha.58",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "docusaurus start",
|
||||
"build": "docusaurus build",
|
||||
"publish-gh-pages": "docusaurus-publish",
|
||||
"examples": "docusaurus-examples",
|
||||
"write-translations": "docusaurus-write-translations",
|
||||
"docusaurus-version": "docusaurus-version",
|
||||
"rename-version": "docusaurus-rename-version",
|
||||
"crowdin-upload": "crowdin --config ../crowdin.yaml upload sources --auto-update -b master",
|
||||
"crowdin-download": "crowdin --config ../crowdin.yaml download -b master",
|
||||
"swizzle": "docusaurus swizzle",
|
||||
"deploy": "docusaurus deploy",
|
||||
"docusaurus": "docusaurus"
|
||||
},
|
||||
\\"dependencies\\": {
|
||||
\\"@docusaurus/core\\": \\"<CURRENT_VERSION>\\",
|
||||
\\"@docusaurus/preset-classic\\": \\"<CURRENT_VERSION>\\",
|
||||
\\"clsx\\": \\"^1.1.1\\",
|
||||
\\"react\\": \\"^17.0.2\\",
|
||||
\\"react-dom\\": \\"^17.0.2\\"
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "<CURRENT_VERSION>",
|
||||
"@docusaurus/preset-classic": "<CURRENT_VERSION>",
|
||||
"clsx": "^1.1.1",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2"
|
||||
}
|
||||
}",
|
||||
],
|
||||
|
|
|
@ -14,14 +14,14 @@ Valid paths you can redirect to:
|
|||
|
||||
exports[`collectRedirects throws if redirect creator creates array of array redirect 1`] = `
|
||||
"Some created redirects are invalid:
|
||||
- {\\"from\\":[\\"/fromPath\\"],\\"to\\":\\"/\\"} => Validation error: \\"from\\" must be a string
|
||||
- {"from":["/fromPath"],"to":"/"} => Validation error: "from" must be a string
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`collectRedirects throws if redirect creator creates invalid redirects 1`] = `
|
||||
"Some created redirects are invalid:
|
||||
- {\\"from\\":\\"https://google.com/\\",\\"to\\":\\"/\\"} => Validation error: \\"from\\" is not a valid pathname. Pathname should start with slash and not contain any domain or query string.
|
||||
- {\\"from\\":\\"//abc\\",\\"to\\":\\"/\\"} => Validation error: \\"from\\" is not a valid pathname. Pathname should start with slash and not contain any domain or query string.
|
||||
- {\\"from\\":\\"/def?queryString=toto\\",\\"to\\":\\"/\\"} => Validation error: \\"from\\" is not a valid pathname. Pathname should start with slash and not contain any domain or query string.
|
||||
- {"from":"https://google.com/","to":"/"} => Validation error: "from" is not a valid pathname. Pathname should start with slash and not contain any domain or query string.
|
||||
- {"from":"//abc","to":"/"} => Validation error: "from" is not a valid pathname. Pathname should start with slash and not contain any domain or query string.
|
||||
- {"from":"/def?queryString=toto","to":"/"} => Validation error: "from" is not a valid pathname. Pathname should start with slash and not contain any domain or query string.
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -4,9 +4,9 @@ exports[`createRedirectPageContent encodes uri special chars 1`] = `
|
|||
"<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset=\\"UTF-8\\">
|
||||
<meta http-equiv=\\"refresh\\" content=\\"0; url=https://docusaurus.io/gr/%CF%83%CE%B5%CE%BB%CE%B9%CE%B4%CE%B1%CF%82/\\">
|
||||
<link rel=\\"canonical\\" href=\\"https://docusaurus.io/gr/%CF%83%CE%B5%CE%BB%CE%B9%CE%B4%CE%B1%CF%82/\\" />
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="refresh" content="0; url=https://docusaurus.io/gr/%CF%83%CE%B5%CE%BB%CE%B9%CE%B4%CE%B1%CF%82/">
|
||||
<link rel="canonical" href="https://docusaurus.io/gr/%CF%83%CE%B5%CE%BB%CE%B9%CE%B4%CE%B1%CF%82/" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = 'https://docusaurus.io/gr/%CF%83%CE%B5%CE%BB%CE%B9%CE%B4%CE%B1%CF%82/';
|
||||
|
@ -18,9 +18,9 @@ exports[`createRedirectPageContent works 1`] = `
|
|||
"<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset=\\"UTF-8\\">
|
||||
<meta http-equiv=\\"refresh\\" content=\\"0; url=https://docusaurus.io/\\">
|
||||
<link rel=\\"canonical\\" href=\\"https://docusaurus.io/\\" />
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="refresh" content="0; url=https://docusaurus.io/">
|
||||
<link rel="canonical" href="https://docusaurus.io/" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = 'https://docusaurus.io/';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`normalizePluginOptions rejects bad createRedirects user inputs 1`] = `"\\"createRedirects\\" must be of type function"`;
|
||||
exports[`normalizePluginOptions rejects bad createRedirects user inputs 1`] = `""createRedirects" must be of type function"`;
|
||||
|
||||
exports[`normalizePluginOptions rejects bad fromExtensions user inputs 1`] = `"\\"fromExtensions[0]\\" contains an invalid value"`;
|
||||
exports[`normalizePluginOptions rejects bad fromExtensions user inputs 1`] = `""fromExtensions[0]" contains an invalid value"`;
|
||||
|
||||
exports[`normalizePluginOptions rejects bad toExtensions user inputs 1`] = `"\\"toExtensions[0]\\" contains an invalid value"`;
|
||||
exports[`normalizePluginOptions rejects bad toExtensions user inputs 1`] = `""toExtensions[0]" contains an invalid value"`;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`validateRedirect throw for bad redirects 1`] = `"{\\"from\\":\\"https://fb.com/fromSomePath\\",\\"to\\":\\"/toSomePath\\"} => Validation error: \\"from\\" is not a valid pathname. Pathname should start with slash and not contain any domain or query string."`;
|
||||
exports[`validateRedirect throw for bad redirects 1`] = `"{"from":"https://fb.com/fromSomePath","to":"/toSomePath"} => Validation error: "from" is not a valid pathname. Pathname should start with slash and not contain any domain or query string."`;
|
||||
|
||||
exports[`validateRedirect throw for bad redirects 2`] = `"{\\"from\\":\\"/fromSomePath\\",\\"to\\":\\"https://fb.com/toSomePath\\"} => Validation error: \\"to\\" is not a valid pathname. Pathname should start with slash and not contain any domain or query string."`;
|
||||
exports[`validateRedirect throw for bad redirects 2`] = `"{"from":"/fromSomePath","to":"https://fb.com/toSomePath"} => Validation error: "to" is not a valid pathname. Pathname should start with slash and not contain any domain or query string."`;
|
||||
|
||||
exports[`validateRedirect throw for bad redirects 3`] = `"{\\"from\\":\\"/fromSomePath\\",\\"to\\":\\"/toSomePath?queryString=xyz\\"} => Validation error: \\"to\\" is not a valid pathname. Pathname should start with slash and not contain any domain or query string."`;
|
||||
exports[`validateRedirect throw for bad redirects 3`] = `"{"from":"/fromSomePath","to":"/toSomePath?queryString=xyz"} => Validation error: "to" is not a valid pathname. Pathname should start with slash and not contain any domain or query string."`;
|
||||
|
||||
exports[`validateRedirect throw for bad redirects 4`] = `"{\\"from\\":null,\\"to\\":\\"/toSomePath?queryString=xyz\\"} => Validation error: \\"from\\" must be a string"`;
|
||||
exports[`validateRedirect throw for bad redirects 4`] = `"{"from":null,"to":"/toSomePath?queryString=xyz"} => Validation error: "from" must be a string"`;
|
||||
|
||||
exports[`validateRedirect throw for bad redirects 5`] = `"{\\"from\\":[\\"hey\\"],\\"to\\":\\"/toSomePath?queryString=xyz\\"} => Validation error: \\"from\\" must be a string"`;
|
||||
exports[`validateRedirect throw for bad redirects 5`] = `"{"from":["hey"],"to":"/toSomePath?queryString=xyz"} => Validation error: "from" must be a string"`;
|
||||
|
|
|
@ -5,9 +5,9 @@ exports[`toRedirectFilesMetadata creates appropriate metadata for empty baseUrl:
|
|||
"<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset=\\"UTF-8\\">
|
||||
<meta http-equiv=\\"refresh\\" content=\\"0; url=/abc\\">
|
||||
<link rel=\\"canonical\\" href=\\"/abc\\" />
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="refresh" content="0; url=/abc">
|
||||
<link rel="canonical" href="/abc" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = '/abc';
|
||||
|
@ -21,9 +21,9 @@ exports[`toRedirectFilesMetadata creates appropriate metadata for root baseUrl:
|
|||
"<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset=\\"UTF-8\\">
|
||||
<meta http-equiv=\\"refresh\\" content=\\"0; url=/abc\\">
|
||||
<link rel=\\"canonical\\" href=\\"/abc\\" />
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="refresh" content="0; url=/abc">
|
||||
<link rel="canonical" href="/abc" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = '/abc';
|
||||
|
@ -37,9 +37,9 @@ exports[`toRedirectFilesMetadata creates appropriate metadata trailingSlash=fals
|
|||
"<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset=\\"UTF-8\\">
|
||||
<meta http-equiv=\\"refresh\\" content=\\"0; url=https://docusaurus.io/abc\\">
|
||||
<link rel=\\"canonical\\" href=\\"https://docusaurus.io/abc\\" />
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="refresh" content="0; url=https://docusaurus.io/abc">
|
||||
<link rel="canonical" href="https://docusaurus.io/abc" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = 'https://docusaurus.io/abc';
|
||||
|
@ -48,9 +48,9 @@ exports[`toRedirectFilesMetadata creates appropriate metadata trailingSlash=fals
|
|||
"<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset=\\"UTF-8\\">
|
||||
<meta http-equiv=\\"refresh\\" content=\\"0; url=https://docusaurus.io/def.html\\">
|
||||
<link rel=\\"canonical\\" href=\\"https://docusaurus.io/def.html\\" />
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="refresh" content="0; url=https://docusaurus.io/def.html">
|
||||
<link rel="canonical" href="https://docusaurus.io/def.html" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = 'https://docusaurus.io/def.html';
|
||||
|
@ -59,9 +59,9 @@ exports[`toRedirectFilesMetadata creates appropriate metadata trailingSlash=fals
|
|||
"<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset=\\"UTF-8\\">
|
||||
<meta http-equiv=\\"refresh\\" content=\\"0; url=https://docusaurus.io/\\">
|
||||
<link rel=\\"canonical\\" href=\\"https://docusaurus.io/\\" />
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="refresh" content="0; url=https://docusaurus.io/">
|
||||
<link rel="canonical" href="https://docusaurus.io/" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = 'https://docusaurus.io/';
|
||||
|
@ -75,9 +75,9 @@ exports[`toRedirectFilesMetadata creates appropriate metadata trailingSlash=true
|
|||
"<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset=\\"UTF-8\\">
|
||||
<meta http-equiv=\\"refresh\\" content=\\"0; url=https://docusaurus.io/abc\\">
|
||||
<link rel=\\"canonical\\" href=\\"https://docusaurus.io/abc\\" />
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="refresh" content="0; url=https://docusaurus.io/abc">
|
||||
<link rel="canonical" href="https://docusaurus.io/abc" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = 'https://docusaurus.io/abc';
|
||||
|
@ -86,9 +86,9 @@ exports[`toRedirectFilesMetadata creates appropriate metadata trailingSlash=true
|
|||
"<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset=\\"UTF-8\\">
|
||||
<meta http-equiv=\\"refresh\\" content=\\"0; url=https://docusaurus.io/def.html\\">
|
||||
<link rel=\\"canonical\\" href=\\"https://docusaurus.io/def.html\\" />
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="refresh" content="0; url=https://docusaurus.io/def.html">
|
||||
<link rel="canonical" href="https://docusaurus.io/def.html" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = 'https://docusaurus.io/def.html';
|
||||
|
@ -97,9 +97,9 @@ exports[`toRedirectFilesMetadata creates appropriate metadata trailingSlash=true
|
|||
"<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset=\\"UTF-8\\">
|
||||
<meta http-equiv=\\"refresh\\" content=\\"0; url=https://docusaurus.io/\\">
|
||||
<link rel=\\"canonical\\" href=\\"https://docusaurus.io/\\" />
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="refresh" content="0; url=https://docusaurus.io/">
|
||||
<link rel="canonical" href="https://docusaurus.io/" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = 'https://docusaurus.io/';
|
||||
|
@ -113,9 +113,9 @@ exports[`toRedirectFilesMetadata creates appropriate metadata trailingSlash=unde
|
|||
"<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset=\\"UTF-8\\">
|
||||
<meta http-equiv=\\"refresh\\" content=\\"0; url=https://docusaurus.io/abc\\">
|
||||
<link rel=\\"canonical\\" href=\\"https://docusaurus.io/abc\\" />
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="refresh" content="0; url=https://docusaurus.io/abc">
|
||||
<link rel="canonical" href="https://docusaurus.io/abc" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = 'https://docusaurus.io/abc';
|
||||
|
@ -124,9 +124,9 @@ exports[`toRedirectFilesMetadata creates appropriate metadata trailingSlash=unde
|
|||
"<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset=\\"UTF-8\\">
|
||||
<meta http-equiv=\\"refresh\\" content=\\"0; url=https://docusaurus.io/def.html\\">
|
||||
<link rel=\\"canonical\\" href=\\"https://docusaurus.io/def.html\\" />
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="refresh" content="0; url=https://docusaurus.io/def.html">
|
||||
<link rel="canonical" href="https://docusaurus.io/def.html" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = 'https://docusaurus.io/def.html';
|
||||
|
@ -135,9 +135,9 @@ exports[`toRedirectFilesMetadata creates appropriate metadata trailingSlash=unde
|
|||
"<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset=\\"UTF-8\\">
|
||||
<meta http-equiv=\\"refresh\\" content=\\"0; url=https://docusaurus.io/\\">
|
||||
<link rel=\\"canonical\\" href=\\"https://docusaurus.io/\\" />
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="refresh" content="0; url=https://docusaurus.io/">
|
||||
<link rel="canonical" href="https://docusaurus.io/" />
|
||||
</head>
|
||||
<script>
|
||||
window.location.href = 'https://docusaurus.io/';
|
||||
|
|
|
@ -15,8 +15,8 @@ describe('createToExtensionsRedirects', () => {
|
|||
expect(() => {
|
||||
createToExtensionsRedirects(['/'], ['']);
|
||||
}).toThrowErrorMatchingInlineSnapshot(`
|
||||
"Extension \\"\\" is not allowed.
|
||||
If the redirect extension system is not good enough for your use case, you can create redirects yourself with the \\"createRedirects\\" plugin option."
|
||||
"Extension "" is not allowed.
|
||||
If the redirect extension system is not good enough for your use case, you can create redirects yourself with the "createRedirects" plugin option."
|
||||
`);
|
||||
});
|
||||
|
||||
|
@ -24,8 +24,8 @@ describe('createToExtensionsRedirects', () => {
|
|||
expect(() => {
|
||||
createToExtensionsRedirects(['/'], ['.html']);
|
||||
}).toThrowErrorMatchingInlineSnapshot(`
|
||||
"Extension \\".html\\" contains a \\".\\" (dot) which is not allowed.
|
||||
If the redirect extension system is not good enough for your use case, you can create redirects yourself with the \\"createRedirects\\" plugin option."
|
||||
"Extension ".html" contains a "." (dot) which is not allowed.
|
||||
If the redirect extension system is not good enough for your use case, you can create redirects yourself with the "createRedirects" plugin option."
|
||||
`);
|
||||
});
|
||||
|
||||
|
@ -33,8 +33,8 @@ describe('createToExtensionsRedirects', () => {
|
|||
expect(() => {
|
||||
createToExtensionsRedirects(['/'], ['ht/ml']);
|
||||
}).toThrowErrorMatchingInlineSnapshot(`
|
||||
"Extension \\"ht/ml\\" contains a \\"/\\" (slash) which is not allowed.
|
||||
If the redirect extension system is not good enough for your use case, you can create redirects yourself with the \\"createRedirects\\" plugin option."
|
||||
"Extension "ht/ml" contains a "/" (slash) which is not allowed.
|
||||
If the redirect extension system is not good enough for your use case, you can create redirects yourself with the "createRedirects" plugin option."
|
||||
`);
|
||||
});
|
||||
|
||||
|
@ -42,8 +42,8 @@ describe('createToExtensionsRedirects', () => {
|
|||
expect(() => {
|
||||
createToExtensionsRedirects(['/'], [',']);
|
||||
}).toThrowErrorMatchingInlineSnapshot(`
|
||||
"Extension \\",\\" contains invalid URI characters.
|
||||
If the redirect extension system is not good enough for your use case, you can create redirects yourself with the \\"createRedirects\\" plugin option."
|
||||
"Extension "," contains invalid URI characters.
|
||||
If the redirect extension system is not good enough for your use case, you can create redirects yourself with the "createRedirects" plugin option."
|
||||
`);
|
||||
});
|
||||
|
||||
|
@ -79,8 +79,8 @@ describe('createFromExtensionsRedirects', () => {
|
|||
expect(() => {
|
||||
createFromExtensionsRedirects(['/'], ['.html']);
|
||||
}).toThrowErrorMatchingInlineSnapshot(`
|
||||
"Extension \\".html\\" contains a \\".\\" (dot) which is not allowed.
|
||||
If the redirect extension system is not good enough for your use case, you can create redirects yourself with the \\"createRedirects\\" plugin option."
|
||||
"Extension ".html" contains a "." (dot) which is not allowed.
|
||||
If the redirect extension system is not good enough for your use case, you can create redirects yourself with the "createRedirects" plugin option."
|
||||
`);
|
||||
});
|
||||
|
||||
|
@ -88,8 +88,8 @@ describe('createFromExtensionsRedirects', () => {
|
|||
expect(() => {
|
||||
createFromExtensionsRedirects(['/'], ['.html']);
|
||||
}).toThrowErrorMatchingInlineSnapshot(`
|
||||
"Extension \\".html\\" contains a \\".\\" (dot) which is not allowed.
|
||||
If the redirect extension system is not good enough for your use case, you can create redirects yourself with the \\"createRedirects\\" plugin option."
|
||||
"Extension ".html" contains a "." (dot) which is not allowed.
|
||||
If the redirect extension system is not good enough for your use case, you can create redirects yourself with the "createRedirects" plugin option."
|
||||
`);
|
||||
});
|
||||
|
||||
|
@ -97,8 +97,8 @@ describe('createFromExtensionsRedirects', () => {
|
|||
expect(() => {
|
||||
createFromExtensionsRedirects(['/'], ['ht/ml']);
|
||||
}).toThrowErrorMatchingInlineSnapshot(`
|
||||
"Extension \\"ht/ml\\" contains a \\"/\\" (slash) which is not allowed.
|
||||
If the redirect extension system is not good enough for your use case, you can create redirects yourself with the \\"createRedirects\\" plugin option."
|
||||
"Extension "ht/ml" contains a "/" (slash) which is not allowed.
|
||||
If the redirect extension system is not good enough for your use case, you can create redirects yourself with the "createRedirects" plugin option."
|
||||
`);
|
||||
});
|
||||
|
||||
|
@ -106,8 +106,8 @@ describe('createFromExtensionsRedirects', () => {
|
|||
expect(() => {
|
||||
createFromExtensionsRedirects(['/'], [',']);
|
||||
}).toThrowErrorMatchingInlineSnapshot(`
|
||||
"Extension \\",\\" contains invalid URI characters.
|
||||
If the redirect extension system is not good enough for your use case, you can create redirects yourself with the \\"createRedirects\\" plugin option."
|
||||
"Extension "," contains invalid URI characters.
|
||||
If the redirect extension system is not good enough for your use case, you can create redirects yourself with the "createRedirects" plugin option."
|
||||
`);
|
||||
});
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`validateOptions throws Error in case of invalid feed type 1`] = `"\\"feedOptions.type\\" does not match any of the allowed types"`;
|
||||
exports[`validateOptions throws Error in case of invalid feed type 1`] = `""feedOptions.type" does not match any of the allowed types"`;
|
||||
|
||||
exports[`validateOptions throws Error in case of invalid options 1`] = `"\\"postsPerPage\\" must be greater than or equal to 1"`;
|
||||
exports[`validateOptions throws Error in case of invalid options 1`] = `""postsPerPage" must be greater than or equal to 1"`;
|
||||
|
|
|
@ -200,13 +200,14 @@ describe('getBlogPostAuthors', () => {
|
|||
frontMatter: {
|
||||
authors: 'slorber',
|
||||
},
|
||||
|
||||
authorsMap: {
|
||||
yangshun: {name: 'Yangshun Tay'},
|
||||
jmarcey: {name: 'Joel Marcey'},
|
||||
},
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(`
|
||||
"Blog author with key \\"slorber\\" not found in the authors map file.
|
||||
"Blog author with key "slorber" not found in the authors map file.
|
||||
Valid author keys are:
|
||||
- yangshun
|
||||
- jmarcey"
|
||||
|
@ -219,13 +220,14 @@ describe('getBlogPostAuthors', () => {
|
|||
frontMatter: {
|
||||
authors: ['yangshun', 'jmarcey', 'slorber'],
|
||||
},
|
||||
|
||||
authorsMap: {
|
||||
yangshun: {name: 'Yangshun Tay'},
|
||||
jmarcey: {name: 'Joel Marcey'},
|
||||
},
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(`
|
||||
"Blog author with key \\"slorber\\" not found in the authors map file.
|
||||
"Blog author with key "slorber" not found in the authors map file.
|
||||
Valid author keys are:
|
||||
- yangshun
|
||||
- jmarcey"
|
||||
|
@ -238,13 +240,14 @@ describe('getBlogPostAuthors', () => {
|
|||
frontMatter: {
|
||||
authors: [{key: 'yangshun'}, {key: 'jmarcey'}, {key: 'slorber'}],
|
||||
},
|
||||
|
||||
authorsMap: {
|
||||
yangshun: {name: 'Yangshun Tay'},
|
||||
jmarcey: {name: 'Joel Marcey'},
|
||||
},
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(`
|
||||
"Blog author with key \\"slorber\\" not found in the authors map file.
|
||||
"Blog author with key "slorber" not found in the authors map file.
|
||||
Valid author keys are:
|
||||
- yangshun
|
||||
- jmarcey"
|
||||
|
@ -372,7 +375,7 @@ describe('validateAuthorsMap', () => {
|
|||
expect(() =>
|
||||
validateAuthorsMap(authorsMap),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"slorber\\" must contain at least one of [name, imageURL]"`,
|
||||
`""slorber" must contain at least one of [name, imageURL]"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -382,7 +385,7 @@ describe('validateAuthorsMap', () => {
|
|||
slorber: undefined,
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"slorber\\" cannot be undefined. It should be an author object containing properties like name, title, and imageURL."`,
|
||||
`""slorber" cannot be undefined. It should be an author object containing properties like name, title, and imageURL."`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -392,7 +395,7 @@ describe('validateAuthorsMap', () => {
|
|||
slorber: null,
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"slorber\\" should be an author object containing properties like name, title, and imageURL."`,
|
||||
`""slorber" should be an author object containing properties like name, title, and imageURL."`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -400,7 +403,7 @@ describe('validateAuthorsMap', () => {
|
|||
expect(() =>
|
||||
validateAuthorsMap({slorber: []}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"slorber\\" should be an author object containing properties like name, title, and imageURL."`,
|
||||
`""slorber" should be an author object containing properties like name, title, and imageURL."`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -414,7 +417,7 @@ describe('validateAuthorsMap', () => {
|
|||
expect(() =>
|
||||
validateAuthorsMap({name: 'Sébastien'}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"name\\" should be an author object containing properties like name, title, and imageURL."`,
|
||||
`""name" should be an author object containing properties like name, title, and imageURL."`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -426,7 +429,7 @@ describe('validateAuthorsMap', () => {
|
|||
expect(() =>
|
||||
validateAuthorsMap(authorsMap),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"slorber\\" should be an author object containing properties like name, title, and imageURL."`,
|
||||
`""slorber" should be an author object containing properties like name, title, and imageURL."`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -139,7 +139,7 @@ describe('validateOptions', () => {
|
|||
it('rejects "abcdef" sidebar count', () => {
|
||||
const userOptions = {blogSidebarCount: 'abcdef'};
|
||||
expect(() => testValidate(userOptions)).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"blogSidebarCount\\" must be one of [ALL, number]"`,
|
||||
`""blogSidebarCount" must be one of [ALL, number]"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -154,7 +154,7 @@ describe('validateOptions', () => {
|
|||
it('rejects 42 sidebar title', () => {
|
||||
const userOptions = {blogSidebarTitle: 42};
|
||||
expect(() => testValidate(userOptions)).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"blogSidebarTitle\\" must be a string"`,
|
||||
`""blogSidebarTitle" must be a string"`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -82,12 +82,12 @@ describe('docsVersion', () => {
|
|||
await expect(() =>
|
||||
cliDocsVersionCommand('..', DEFAULT_OPTIONS, {siteDir: simpleSiteDir}),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"[docs]: invalid version tag specified! Do not name your version \\".\\" or \\"..\\". Try something like: 1.0.0."`,
|
||||
`"[docs]: invalid version tag specified! Do not name your version "." or "..". Try something like: 1.0.0."`,
|
||||
);
|
||||
await expect(() =>
|
||||
cliDocsVersionCommand('.', DEFAULT_OPTIONS, {siteDir: simpleSiteDir}),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"[docs]: invalid version tag specified! Do not name your version \\".\\" or \\"..\\". Try something like: 1.0.0."`,
|
||||
`"[docs]: invalid version tag specified! Do not name your version "." or "..". Try something like: 1.0.0."`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -133,7 +133,7 @@ describe('docsVersion', () => {
|
|||
i18n: {locales: ['en', 'zh-Hans'], defaultLocale: 'en'},
|
||||
}),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"[docs]: no docs found in [36m[4m\\"<PROJECT_ROOT>/packages/docusaurus-plugin-content-docs/src/__tests__/__fixtures__/empty-site/docs\\"[24m[39m."`,
|
||||
`"[docs]: no docs found in "<PROJECT_ROOT>/packages/docusaurus-plugin-content-docs/src/__tests__/__fixtures__/empty-site/docs"."`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -249,7 +249,7 @@ describe('docsVersion', () => {
|
|||
),
|
||||
);
|
||||
expect(warnMock.mock.calls[0][0]).toMatchInlineSnapshot(
|
||||
`"[33m[1m[WARNING][22m [docs]: no docs found in [36m[4m\\"<PROJECT_ROOT>/packages/docusaurus-plugin-content-docs/src/__tests__/__fixtures__/versioned-site/i18n/zh-Hans/docusaurus-plugin-content-docs/current\\"[24m[39m[33m. Skipping.[39m"`,
|
||||
`"[WARNING] [docs]: no docs found in "<PROJECT_ROOT>/packages/docusaurus-plugin-content-docs/src/__tests__/__fixtures__/versioned-site/i18n/zh-Hans/docusaurus-plugin-content-docs/current". Skipping."`,
|
||||
);
|
||||
|
||||
warnMock.mockRestore();
|
||||
|
|
|
@ -487,7 +487,7 @@ describe('simple site', () => {
|
|||
}),
|
||||
),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"Document id \\"Hello/world\\" cannot include slash."`,
|
||||
`"Document id "Hello/world" cannot include slash."`,
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -143,10 +143,11 @@ 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 to generate it automatically"
|
||||
|
@ -203,7 +204,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 \\"docs\\"."`,
|
||||
`"Docs version "current" has no docs! At least one doc should exist at "docs"."`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -220,7 +221,7 @@ describe('empty/no docs website', () => {
|
|||
}),
|
||||
),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"The docs folder does not exist for version \\"current\\". A docs folder is expected to be found at path/does/not/exist."`,
|
||||
`"The docs folder does not exist for version "current". A docs folder is expected to be found at path/does/not/exist."`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -117,7 +117,7 @@ describe('normalizeDocsPluginOptions', () => {
|
|||
expect(() =>
|
||||
testValidate(admonitionsTrue),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"admonitions\\" contains an invalid value"`,
|
||||
`""admonitions" contains an invalid value"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -151,9 +151,9 @@ describe('normalizeDocsPluginOptions', () => {
|
|||
remarkPlugins: [[{option1: '42'}, markdownPluginsFunctionStub]],
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(`
|
||||
"\\"remarkPlugins[0]\\" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require(\\"rehype-katex\\"), { strict: false }]\`, or
|
||||
- A simple module, like \`require(\\"remark-math\\")\`"
|
||||
""remarkPlugins[0]" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require("rehype-katex"), { strict: false }]\`, or
|
||||
- A simple module, like \`require("remark-math")\`"
|
||||
`);
|
||||
});
|
||||
|
||||
|
@ -169,46 +169,42 @@ describe('normalizeDocsPluginOptions', () => {
|
|||
],
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(`
|
||||
"\\"rehypePlugins[0]\\" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require(\\"rehype-katex\\"), { strict: false }]\`, or
|
||||
- A simple module, like \`require(\\"remark-math\\")\`"
|
||||
""rehypePlugins[0]" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require("rehype-katex"), { strict: false }]\`, or
|
||||
- A simple module, like \`require("remark-math")\`"
|
||||
`);
|
||||
});
|
||||
|
||||
it('rejects bad path inputs', () => {
|
||||
expect(() => testValidate({path: 2})).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"path\\" must be a string"`,
|
||||
`""path" must be a string"`,
|
||||
);
|
||||
});
|
||||
|
||||
it('rejects bad include inputs', () => {
|
||||
expect(() =>
|
||||
testValidate({include: '**/*.{md,mdx}'}),
|
||||
).toThrowErrorMatchingInlineSnapshot(`"\\"include\\" must be an array"`);
|
||||
).toThrowErrorMatchingInlineSnapshot(`""include" must be an array"`);
|
||||
});
|
||||
|
||||
it('rejects bad showLastUpdateTime inputs', () => {
|
||||
expect(() =>
|
||||
testValidate({showLastUpdateTime: 'true'}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"showLastUpdateTime\\" must be a boolean"`,
|
||||
`""showLastUpdateTime" must be a boolean"`,
|
||||
);
|
||||
});
|
||||
|
||||
it('rejects bad remarkPlugins input', () => {
|
||||
expect(() =>
|
||||
testValidate({remarkPlugins: 'remark-math'}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"remarkPlugins\\" must be an array"`,
|
||||
);
|
||||
).toThrowErrorMatchingInlineSnapshot(`""remarkPlugins" must be an array"`);
|
||||
});
|
||||
|
||||
it('rejects bad lastVersion', () => {
|
||||
expect(() =>
|
||||
testValidate({lastVersion: false}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"lastVersion\\" must be a string"`,
|
||||
);
|
||||
).toThrowErrorMatchingInlineSnapshot(`""lastVersion" must be a string"`);
|
||||
});
|
||||
|
||||
it('rejects bad versions', () => {
|
||||
|
@ -218,6 +214,7 @@ describe('normalizeDocsPluginOptions', () => {
|
|||
current: {
|
||||
hey: 3,
|
||||
},
|
||||
|
||||
version1: {
|
||||
path: 'hello',
|
||||
label: 'world',
|
||||
|
@ -225,7 +222,7 @@ describe('normalizeDocsPluginOptions', () => {
|
|||
},
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"versions.current.hey\\" is not allowed"`,
|
||||
`""versions.current.hey" is not allowed"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ describe('getSlug', () => {
|
|||
frontMatterSlug: '//',
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(`
|
||||
"We couldn't compute a valid slug for document with ID \\"my dôc\\" in \\"/dir with spâce/hey $hello\\" directory.
|
||||
"We couldn't compute a valid slug for document with ID "my dôc" in "/dir with spâce/hey $hello" directory.
|
||||
The slug we computed looks invalid: //.
|
||||
Maybe your slug front matter is incorrect or there are special characters in the file path?
|
||||
By using front matter to set a custom slug, you should be able to fix this error:
|
||||
|
|
|
@ -187,10 +187,11 @@ describe('readVersionsMetadata', () => {
|
|||
unknownVersionName2: {label: 'unknownVersionName2'},
|
||||
},
|
||||
},
|
||||
|
||||
context: defaultContext,
|
||||
}),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"Invalid docs option \\"versions\\": unknown versions (unknownVersionName1,unknownVersionName2) found. Available version names are: current"`,
|
||||
`"Invalid docs option "versions": unknown versions (unknownVersionName1,unknownVersionName2) found. Available version names are: current"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -203,7 +204,7 @@ describe('readVersionsMetadata', () => {
|
|||
context: defaultContext,
|
||||
}),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"Docs: using \\"disableVersioning: true\\" option on a non-versioned site does not make sense."`,
|
||||
`"Docs: using "disableVersioning: true" option on a non-versioned site does not make sense."`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -216,7 +217,7 @@ describe('readVersionsMetadata', () => {
|
|||
context: defaultContext,
|
||||
}),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"It is not possible to use docs without any version. Please check the configuration of these options: \\"includeCurrentVersion: false\\", \\"disableVersioning: false\\"."`,
|
||||
`"It is not possible to use docs without any version. Please check the configuration of these options: "includeCurrentVersion: false", "disableVersioning: false"."`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -557,10 +558,11 @@ describe('readVersionsMetadata', () => {
|
|||
includeCurrentVersion: false,
|
||||
disableVersioning: true,
|
||||
},
|
||||
|
||||
context: defaultContext,
|
||||
}),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"It is not possible to use docs without any version. Please check the configuration of these options: \\"includeCurrentVersion: false\\", \\"disableVersioning: true\\"."`,
|
||||
`"It is not possible to use docs without any version. Please check the configuration of these options: "includeCurrentVersion: false", "disableVersioning: true"."`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -573,10 +575,11 @@ describe('readVersionsMetadata', () => {
|
|||
...defaultOptions,
|
||||
onlyIncludeVersions: [],
|
||||
},
|
||||
|
||||
context: defaultContext,
|
||||
}),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"Invalid docs option \\"onlyIncludeVersions\\": an empty array is not allowed, at least one version is needed."`,
|
||||
`"Invalid docs option "onlyIncludeVersions": an empty array is not allowed, at least one version is needed."`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -589,10 +592,11 @@ describe('readVersionsMetadata', () => {
|
|||
...defaultOptions,
|
||||
onlyIncludeVersions: ['unknownVersion1', 'unknownVersion2'],
|
||||
},
|
||||
|
||||
context: defaultContext,
|
||||
}),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"Invalid docs option \\"onlyIncludeVersions\\": unknown versions (unknownVersion1,unknownVersion2) found. Available version names are: current, 1.0.1, 1.0.0, withSlugs"`,
|
||||
`"Invalid docs option "onlyIncludeVersions": unknown versions (unknownVersion1,unknownVersion2) found. Available version names are: current, 1.0.1, 1.0.0, withSlugs"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -606,10 +610,11 @@ describe('readVersionsMetadata', () => {
|
|||
lastVersion: '1.0.1',
|
||||
onlyIncludeVersions: ['current', '1.0.0'],
|
||||
},
|
||||
|
||||
context: defaultContext,
|
||||
}),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"Invalid docs option \\"lastVersion\\": if you use both the \\"onlyIncludeVersions\\" and \\"lastVersion\\" options, then \\"lastVersion\\" must be present in the provided \\"onlyIncludeVersions\\" array."`,
|
||||
`"Invalid docs option "lastVersion": if you use both the "onlyIncludeVersions" and "lastVersion" options, then "lastVersion" must be present in the provided "onlyIncludeVersions" array."`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -627,7 +632,7 @@ describe('readVersionsMetadata', () => {
|
|||
context: defaultContext,
|
||||
}),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"The versions file should contain an array of version names! Found content: {\\"invalid\\":\\"json\\"}"`,
|
||||
`"The versions file should contain an array of version names! Found content: {"invalid":"json"}"`,
|
||||
);
|
||||
jsonMock.mockImplementationOnce(() => [1.1]);
|
||||
|
||||
|
@ -637,7 +642,7 @@ describe('readVersionsMetadata', () => {
|
|||
context: defaultContext,
|
||||
}),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"Versions should be strings. Found type \\"number\\" for version \\"1.1\\"."`,
|
||||
`"Versions should be strings. Found type "number" for version "1.1"."`,
|
||||
);
|
||||
jsonMock.mockImplementationOnce(() => [' ']);
|
||||
|
||||
|
@ -646,9 +651,7 @@ describe('readVersionsMetadata', () => {
|
|||
options: defaultOptions,
|
||||
context: defaultContext,
|
||||
}),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"Invalid version \\" \\"."`,
|
||||
);
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(`"Invalid version " "."`);
|
||||
jsonMock.mockRestore();
|
||||
});
|
||||
});
|
||||
|
@ -772,10 +775,11 @@ describe('readVersionsMetadata', () => {
|
|||
includeCurrentVersion: false,
|
||||
disableVersioning: true,
|
||||
},
|
||||
|
||||
context: defaultContext,
|
||||
}),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"It is not possible to use docs without any version. Please check the configuration of these options: \\"includeCurrentVersion: false\\", \\"disableVersioning: true\\"."`,
|
||||
`"It is not possible to use docs without any version. Please check the configuration of these options: "includeCurrentVersion: false", "disableVersioning: true"."`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -38,12 +38,12 @@ describe('docsClientUtils', () => {
|
|||
expect(() =>
|
||||
getActivePlugin(data, '/', {failfast: true}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Can't find active docs plugin for \\"/\\" pathname, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: /ios, /android"`,
|
||||
`"Can't find active docs plugin for "/" pathname, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: /ios, /android"`,
|
||||
);
|
||||
expect(() =>
|
||||
getActivePlugin(data, '/xyz', {failfast: true}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Can't find active docs plugin for \\"/xyz\\" pathname, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: /ios, /android"`,
|
||||
`"Can't find active docs plugin for "/xyz" pathname, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: /ios, /android"`,
|
||||
);
|
||||
|
||||
const activePluginIos: ActivePlugin = {
|
||||
|
|
|
@ -200,7 +200,7 @@ describe('linkify', () => {
|
|||
await expect(() =>
|
||||
transform(doc1),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"Unexpected error: Markdown file at \\"<PROJECT_ROOT>/packages/docusaurus-plugin-content-docs/src/markdown/__tests__/__fixtures__/outside/doc1.md\\" does not belong to any docs version!"`,
|
||||
`"Unexpected error: Markdown file at "<PROJECT_ROOT>/packages/docusaurus-plugin-content-docs/src/markdown/__tests__/__fixtures__/outside/doc1.md" does not belong to any docs version!"`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -62,7 +62,7 @@ describe('loadSidebars', () => {
|
|||
await expect(() =>
|
||||
loadSidebars(sidebarPath, params),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"Invalid sidebar items collection [36m\`\\"doc1\\"\`[39m in [36m\`items\`[39m of the category [34m[1mCategory Label[22m[39m: it must either be an array of sidebar items or a shorthand notation (which doesn't contain a [36m\`type\`[39m property). See [36m[4mhttps://docusaurus.io/docs/sidebar/items[24m[39m for all valid syntaxes."`,
|
||||
`"Invalid sidebar items collection \`"doc1"\` in \`items\` of the category Category Label: it must either be an array of sidebar items or a shorthand notation (which doesn't contain a \`type\` property). See https://docusaurus.io/docs/sidebar/items for all valid syntaxes."`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -131,7 +131,7 @@ describe('loadSidebars', () => {
|
|||
contentPathLocalized: path.join(fixtureDir, 'invalid-docs'),
|
||||
},
|
||||
}),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(`"\\"foo\\" is not allowed"`);
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(`""foo" is not allowed"`);
|
||||
expect(consoleWarnMock).toBeCalledWith(
|
||||
expect.stringMatching(
|
||||
/.*\[WARNING\].* There are more than one category metadata files for .*foo.*: foo\/_category_.json, foo\/_category_.yml. The behavior is undetermined./,
|
||||
|
|
|
@ -46,7 +46,7 @@ describe('normalization', () => {
|
|||
},
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Invalid sidebar items collection [36m\`{\\"type\\":\\"autogenerated\\",\\"dirName\\":\\"foo\\"}\`[39m in [36m\`items\`[39m of the category [34m[1mCategory[22m[39m: it must either be an array of sidebar items or a shorthand notation (which doesn't contain a [36m\`type\`[39m property). See [36m[4mhttps://docusaurus.io/docs/sidebar/items[24m[39m for all valid syntaxes."`,
|
||||
`"Invalid sidebar items collection \`{"type":"autogenerated","dirName":"foo"}\` in \`items\` of the category Category: it must either be an array of sidebar items or a shorthand notation (which doesn't contain a \`type\` property). See https://docusaurus.io/docs/sidebar/items for all valid syntaxes."`,
|
||||
);
|
||||
|
||||
expect(() =>
|
||||
|
@ -62,7 +62,7 @@ describe('normalization', () => {
|
|||
],
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Invalid sidebar items collection [36m\`{\\"type\\":\\"category\\",\\"items\\":[\\"bar\\",\\"baz\\"]}\`[39m in [36m\`items\`[39m of the category [34m[1mCategory[22m[39m: it must either be an array of sidebar items or a shorthand notation (which doesn't contain a [36m\`type\`[39m property). See [36m[4mhttps://docusaurus.io/docs/sidebar/items[24m[39m for all valid syntaxes."`,
|
||||
`"Invalid sidebar items collection \`{"type":"category","items":["bar","baz"]}\` in \`items\` of the category Category: it must either be an array of sidebar items or a shorthand notation (which doesn't contain a \`type\` property). See https://docusaurus.io/docs/sidebar/items for all valid syntaxes."`,
|
||||
);
|
||||
|
||||
expect(() =>
|
||||
|
@ -75,7 +75,7 @@ describe('normalization', () => {
|
|||
],
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Invalid sidebar items collection [36m\`\\"bar\\"\`[39m in [36m\`items\`[39m of the category [34m[1mCategory[22m[39m: it must either be an array of sidebar items or a shorthand notation (which doesn't contain a [36m\`type\`[39m property). See [36m[4mhttps://docusaurus.io/docs/sidebar/items[24m[39m for all valid syntaxes."`,
|
||||
`"Invalid sidebar items collection \`"bar"\` in \`items\` of the category Category: it must either be an array of sidebar items or a shorthand notation (which doesn't contain a \`type\` property). See https://docusaurus.io/docs/sidebar/items for all valid syntaxes."`,
|
||||
);
|
||||
|
||||
expect(() =>
|
||||
|
@ -83,8 +83,7 @@ describe('normalization', () => {
|
|||
sidebar: 'item',
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
// cSpell:ignore msidebar
|
||||
`"Invalid sidebar items collection [36m\`\\"item\\"\`[39m in sidebar [34m[1msidebar[22m[39m: it must either be an array of sidebar items or a shorthand notation (which doesn't contain a [36m\`type\`[39m property). See [36m[4mhttps://docusaurus.io/docs/sidebar/items[24m[39m for all valid syntaxes."`,
|
||||
`"Invalid sidebar items collection \`"item"\` in sidebar sidebar: it must either be an array of sidebar items or a shorthand notation (which doesn't contain a \`type\` property). See https://docusaurus.io/docs/sidebar/items for all valid syntaxes."`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -13,11 +13,11 @@ describe('validateSidebars', () => {
|
|||
expect(() => validateSidebars({sidebar: [{type: 42}]}))
|
||||
.toThrowErrorMatchingInlineSnapshot(`
|
||||
"{
|
||||
\\"type\\": 42,
|
||||
[41m\\"undefined\\"[0m[31m [1]: -- missing --[0m
|
||||
"type": 42,
|
||||
"undefined" [1]: -- missing --
|
||||
}
|
||||
[31m
|
||||
[1] Unknown sidebar item type \\"42\\".[0m"
|
||||
|
||||
[1] Unknown sidebar item type "42"."
|
||||
`);
|
||||
});
|
||||
|
||||
|
@ -53,20 +53,21 @@ describe('validateSidebars', () => {
|
|||
},
|
||||
],
|
||||
}),
|
||||
|
||||
// eslint-disable-next-line jest/no-large-snapshots
|
||||
).toThrowErrorMatchingInlineSnapshot(`
|
||||
"{
|
||||
\\"type\\": \\"category\\",
|
||||
\\"items\\": [
|
||||
"type": "category",
|
||||
"items": [
|
||||
{
|
||||
\\"type\\": \\"doc\\",
|
||||
\\"id\\": \\"doc1\\"
|
||||
"type": "doc",
|
||||
"id": "doc1"
|
||||
}
|
||||
],
|
||||
\\"label\\" [31m[1][0m: true
|
||||
"label" [1]: true
|
||||
}
|
||||
[31m
|
||||
[1] \\"label\\" must be a string[0m"
|
||||
|
||||
[1] "label" must be a string"
|
||||
`);
|
||||
});
|
||||
|
||||
|
@ -82,14 +83,14 @@ describe('validateSidebars', () => {
|
|||
],
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(`
|
||||
"{
|
||||
\\"type\\": \\"link\\",
|
||||
\\"href\\": \\"https://github.com\\",
|
||||
\\"label\\" [31m[1][0m: false
|
||||
}
|
||||
[31m
|
||||
[1] \\"label\\" must be a string[0m"
|
||||
`);
|
||||
"{
|
||||
"type": "link",
|
||||
"href": "https://github.com",
|
||||
"label" [1]: false
|
||||
}
|
||||
|
||||
[1] "label" must be a string"
|
||||
`);
|
||||
});
|
||||
|
||||
it('sidebars link wrong href', () => {
|
||||
|
@ -104,16 +105,16 @@ describe('validateSidebars', () => {
|
|||
],
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(`
|
||||
"{
|
||||
\\"type\\": \\"link\\",
|
||||
\\"label\\": \\"GitHub\\",
|
||||
\\"href\\" [31m[1][0m: [
|
||||
\\"example.com\\"
|
||||
]
|
||||
}
|
||||
[31m
|
||||
[1] \\"href\\" contains an invalid value[0m"
|
||||
`);
|
||||
"{
|
||||
"type": "link",
|
||||
"label": "GitHub",
|
||||
"href" [1]: [
|
||||
"example.com"
|
||||
]
|
||||
}
|
||||
|
||||
[1] "href" contains an invalid value"
|
||||
`);
|
||||
});
|
||||
|
||||
it('sidebars with unknown sidebar item type', () => {
|
||||
|
@ -126,13 +127,13 @@ describe('validateSidebars', () => {
|
|||
],
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(`
|
||||
"{
|
||||
\\"type\\": \\"superman\\",
|
||||
[41m\\"undefined\\"[0m[31m [1]: -- missing --[0m
|
||||
}
|
||||
[31m
|
||||
[1] Unknown sidebar item type \\"superman\\".[0m"
|
||||
`);
|
||||
"{
|
||||
"type": "superman",
|
||||
"undefined" [1]: -- missing --
|
||||
}
|
||||
|
||||
[1] Unknown sidebar item type "superman"."
|
||||
`);
|
||||
});
|
||||
|
||||
it('sidebars category missing items', () => {
|
||||
|
@ -152,12 +153,12 @@ describe('validateSidebars', () => {
|
|||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(`
|
||||
"{
|
||||
\\"type\\": \\"category\\",
|
||||
\\"label\\": \\"category\\",
|
||||
[41m\\"items\\"[0m[31m [1]: -- missing --[0m
|
||||
"type": "category",
|
||||
"label": "category",
|
||||
"items" [1]: -- missing --
|
||||
}
|
||||
[31m
|
||||
[1] \\"items\\" is required[0m"
|
||||
|
||||
[1] "items" is required"
|
||||
`);
|
||||
});
|
||||
|
||||
|
@ -180,13 +181,13 @@ describe('validateSidebars', () => {
|
|||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(`
|
||||
"{
|
||||
\\"type\\": \\"category\\",
|
||||
\\"label\\": \\"category\\",
|
||||
\\"items\\": [],
|
||||
\\"href\\" [31m[1][0m: \\"https://google.com\\"
|
||||
"type": "category",
|
||||
"label": "category",
|
||||
"items": [],
|
||||
"href" [1]: "https://google.com"
|
||||
}
|
||||
[31m
|
||||
[1] \\"href\\" is not allowed[0m"
|
||||
|
||||
[1] "href" is not allowed"
|
||||
`);
|
||||
});
|
||||
|
||||
|
@ -217,15 +218,15 @@ describe('validateSidebars', () => {
|
|||
],
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(`
|
||||
"{
|
||||
\\"type\\": \\"doc\\",
|
||||
\\"id\\" [31m[1][0m: [
|
||||
\\"doc1\\"
|
||||
]
|
||||
}
|
||||
[31m
|
||||
[1] \\"id\\" must be a string[0m"
|
||||
`);
|
||||
"{
|
||||
"type": "doc",
|
||||
"id" [1]: [
|
||||
"doc1"
|
||||
]
|
||||
}
|
||||
|
||||
[1] "id" must be a string"
|
||||
`);
|
||||
});
|
||||
|
||||
it('html type requires a value', () => {
|
||||
|
@ -240,11 +241,11 @@ describe('validateSidebars', () => {
|
|||
expect(() => validateSidebars(sidebars))
|
||||
.toThrowErrorMatchingInlineSnapshot(`
|
||||
"{
|
||||
\\"type\\": \\"html\\",
|
||||
[41m\\"value\\"[0m[31m [1]: -- missing --[0m
|
||||
"type": "html",
|
||||
"value" [1]: -- missing --
|
||||
}
|
||||
[31m
|
||||
[1] \\"value\\" is required[0m"
|
||||
|
||||
[1] "value" is required"
|
||||
`);
|
||||
});
|
||||
|
||||
|
@ -269,9 +270,7 @@ describe('validateCategoryMetadataFile', () => {
|
|||
it('throw for bad value', async () => {
|
||||
expect(() =>
|
||||
validateCategoryMetadataFile(42),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"value\\" must be of type object"`,
|
||||
);
|
||||
).toThrowErrorMatchingInlineSnapshot(`""value" must be of type object"`);
|
||||
});
|
||||
|
||||
it('accept empty object', async () => {
|
||||
|
@ -314,8 +313,6 @@ describe('validateCategoryMetadataFile', () => {
|
|||
};
|
||||
expect(() =>
|
||||
validateCategoryMetadataFile(content),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"link.permalink\\" is not allowed"`,
|
||||
);
|
||||
).toThrowErrorMatchingInlineSnapshot(`""link.permalink" is not allowed"`);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -49,6 +49,6 @@ describe('normalizePagesPluginOptions', () => {
|
|||
// @ts-expect-error: bad attribute
|
||||
path: 42,
|
||||
});
|
||||
}).toThrowErrorMatchingInlineSnapshot(`"\\"path\\" must be a string"`);
|
||||
}).toThrowErrorMatchingInlineSnapshot(`""path" must be a string"`);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -39,7 +39,7 @@ describe('validateOptions', () => {
|
|||
expect(() =>
|
||||
testValidate({priority: 2}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"priority\\" must be less than or equal to 1"`,
|
||||
`""priority" must be less than or equal to 1"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -47,20 +47,18 @@ describe('validateOptions', () => {
|
|||
expect(() =>
|
||||
testValidate({changefreq: 'annually'}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"changefreq\\" must be one of [daily, monthly, always, hourly, weekly, yearly, never]"`,
|
||||
`""changefreq" must be one of [daily, monthly, always, hourly, weekly, yearly, never]"`,
|
||||
);
|
||||
});
|
||||
|
||||
it('rejects bad ignorePatterns inputs', () => {
|
||||
expect(() =>
|
||||
testValidate({ignorePatterns: '/search'}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"ignorePatterns\\" must be an array"`,
|
||||
);
|
||||
).toThrowErrorMatchingInlineSnapshot(`""ignorePatterns" must be an array"`);
|
||||
expect(() =>
|
||||
testValidate({ignorePatterns: [/^\/search/]}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"ignorePatterns[0]\\" must be a string"`,
|
||||
`""ignorePatterns[0]" must be a string"`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,14 +6,14 @@ exports[`npm2yarn plugin does not re-import tabs components when already importe
|
|||
import TabItem from '@theme/TabItem';
|
||||
|
||||
<Tabs>
|
||||
<TabItem value=\\"npm\\">
|
||||
<TabItem value="npm">
|
||||
|
||||
\`\`\`bash
|
||||
$ npm install --global docusaurus
|
||||
\`\`\`
|
||||
|
||||
</TabItem>
|
||||
<TabItem value=\\"yarn\\" label=\\"Yarn\\">
|
||||
<TabItem value="yarn" label="Yarn">
|
||||
|
||||
\`\`\`bash
|
||||
$ yarn add --global docusaurus
|
||||
|
@ -26,14 +26,14 @@ import TabItem from '@theme/TabItem';
|
|||
|
||||
exports[`npm2yarn plugin does not re-import tabs components when already imported below 1`] = `
|
||||
"<Tabs>
|
||||
<TabItem value=\\"npm\\">
|
||||
<TabItem value="npm">
|
||||
|
||||
\`\`\`bash
|
||||
$ npm install --global docusaurus
|
||||
\`\`\`
|
||||
|
||||
</TabItem>
|
||||
<TabItem value=\\"yarn\\" label=\\"Yarn\\">
|
||||
<TabItem value="yarn" label="Yarn">
|
||||
|
||||
\`\`\`bash
|
||||
$ yarn add --global docusaurus
|
||||
|
@ -68,14 +68,14 @@ exports[`npm2yarn plugin works on installation file 1`] = `
|
|||
import TabItem from '@theme/TabItem';
|
||||
|
||||
<Tabs>
|
||||
<TabItem value=\\"npm\\">
|
||||
<TabItem value="npm">
|
||||
|
||||
\`\`\`bash
|
||||
$ npm install --global docusaurus
|
||||
\`\`\`
|
||||
|
||||
</TabItem>
|
||||
<TabItem value=\\"yarn\\" label=\\"Yarn\\">
|
||||
<TabItem value="yarn" label="Yarn">
|
||||
|
||||
\`\`\`bash
|
||||
$ yarn add --global docusaurus
|
||||
|
@ -95,14 +95,14 @@ import TabItem from '@theme/TabItem';
|
|||
A plugin is usually a npm package, so you install them like other npm packages using npm.
|
||||
|
||||
<Tabs>
|
||||
<TabItem value=\\"npm\\">
|
||||
<TabItem value="npm">
|
||||
|
||||
\`\`\`bash
|
||||
npm install --save docusaurus-plugin-name
|
||||
\`\`\`
|
||||
|
||||
</TabItem>
|
||||
<TabItem value=\\"yarn\\" label=\\"Yarn\\">
|
||||
<TabItem value="yarn" label="Yarn">
|
||||
|
||||
\`\`\`bash
|
||||
yarn add docusaurus-plugin-name
|
||||
|
@ -121,15 +121,15 @@ import TabItem from '@theme/TabItem';
|
|||
|
||||
A plugin is usually a npm package, so you install them like other npm packages using npm.
|
||||
|
||||
<Tabs groupId=\\"npm2yarn\\">
|
||||
<TabItem value=\\"npm\\">
|
||||
<Tabs groupId="npm2yarn">
|
||||
<TabItem value="npm">
|
||||
|
||||
\`\`\`bash
|
||||
npm install --save docusaurus-plugin-name
|
||||
\`\`\`
|
||||
|
||||
</TabItem>
|
||||
<TabItem value=\\"yarn\\" label=\\"Yarn\\">
|
||||
<TabItem value="yarn" label="Yarn">
|
||||
|
||||
\`\`\`bash
|
||||
yarn add docusaurus-plugin-name
|
||||
|
|
|
@ -295,7 +295,7 @@ describe('themeConfig', () => {
|
|||
expect(() =>
|
||||
testValidateThemeConfig(config),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"navbar.items[0].items[0].position\\" is not allowed"`,
|
||||
`""navbar.items[0].items[0].position" is not allowed"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -315,7 +315,7 @@ describe('themeConfig', () => {
|
|||
expect(() =>
|
||||
testValidateThemeConfig(config),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"One and only one between \\"to\\" and \\"href\\" should be provided"`,
|
||||
`"One and only one between "to" and "href" should be provided"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -514,7 +514,7 @@ describe('themeConfig', () => {
|
|||
customCss: 42,
|
||||
}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"customCss\\" must be one of [array, string]"`,
|
||||
`""customCss" must be one of [array, string]"`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -624,7 +624,7 @@ describe('themeConfig', () => {
|
|||
expect(() =>
|
||||
testValidateThemeConfig({tableOfContents}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"tableOfContents.minHeadingLevel\\" must be an integer"`,
|
||||
`""tableOfContents.minHeadingLevel" must be an integer"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -635,7 +635,7 @@ describe('themeConfig', () => {
|
|||
expect(() =>
|
||||
testValidateThemeConfig({tableOfContents}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"tableOfContents.maxHeadingLevel\\" must be an integer"`,
|
||||
`""tableOfContents.maxHeadingLevel" must be an integer"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -646,7 +646,7 @@ describe('themeConfig', () => {
|
|||
expect(() =>
|
||||
testValidateThemeConfig({tableOfContents}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"tableOfContents.minHeadingLevel\\" must be greater than or equal to 2"`,
|
||||
`""tableOfContents.minHeadingLevel" must be greater than or equal to 2"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -657,7 +657,7 @@ describe('themeConfig', () => {
|
|||
expect(() =>
|
||||
testValidateThemeConfig({tableOfContents}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"tableOfContents.minHeadingLevel\\" must be less than or equal to ref:maxHeadingLevel"`,
|
||||
`""tableOfContents.minHeadingLevel" must be less than or equal to ref:maxHeadingLevel"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -668,7 +668,7 @@ describe('themeConfig', () => {
|
|||
expect(() =>
|
||||
testValidateThemeConfig({tableOfContents}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"tableOfContents.maxHeadingLevel\\" must be greater than or equal to 2"`,
|
||||
`""tableOfContents.maxHeadingLevel" must be greater than or equal to 2"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -679,7 +679,7 @@ describe('themeConfig', () => {
|
|||
expect(() =>
|
||||
testValidateThemeConfig({tableOfContents}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"tableOfContents.maxHeadingLevel\\" must be less than or equal to 6"`,
|
||||
`""tableOfContents.maxHeadingLevel" must be less than or equal to 6"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -691,7 +691,7 @@ describe('themeConfig', () => {
|
|||
expect(() =>
|
||||
testValidateThemeConfig({tableOfContents}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"tableOfContents.minHeadingLevel\\" must be less than or equal to ref:maxHeadingLevel"`,
|
||||
`""tableOfContents.minHeadingLevel" must be less than or equal to ref:maxHeadingLevel"`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -24,7 +24,7 @@ describe('Tabs', () => {
|
|||
</Tabs>,
|
||||
);
|
||||
}).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Docusaurus error: Bad <Tabs> child <div>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique \\"value\\" prop."`,
|
||||
`"Docusaurus error: Bad <Tabs> child <div>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop."`,
|
||||
);
|
||||
});
|
||||
it('rejects bad Tabs defaultValue', () => {
|
||||
|
@ -36,7 +36,7 @@ describe('Tabs', () => {
|
|||
</Tabs>,
|
||||
);
|
||||
}).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Docusaurus error: The <Tabs> has a defaultValue \\"bad\\" but none of its children has the corresponding value. Available values are: v1, v2. If you intend to show no default tab, use defaultValue={null} instead."`,
|
||||
`"Docusaurus error: The <Tabs> has a defaultValue "bad" but none of its children has the corresponding value. Available values are: v1, v2. If you intend to show no default tab, use defaultValue={null} instead."`,
|
||||
);
|
||||
});
|
||||
it('rejects duplicate values', () => {
|
||||
|
@ -52,7 +52,7 @@ describe('Tabs', () => {
|
|||
</Tabs>,
|
||||
);
|
||||
}).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Docusaurus error: Duplicate values \\"v1, v2\\" found in <Tabs>. Every value needs to be unique."`,
|
||||
`"Docusaurus error: Duplicate values "v1, v2" found in <Tabs>. Every value needs to be unique."`,
|
||||
);
|
||||
});
|
||||
it('accepts valid Tabs config', () => {
|
||||
|
|
|
@ -126,7 +126,7 @@ dddd
|
|||
|
||||
\`\`\`js
|
||||
// highlight-next-line
|
||||
console.log(\\"preserved\\");
|
||||
console.log("preserved");
|
||||
\`\`\`",
|
||||
"highlightLines": [
|
||||
1,
|
||||
|
|
|
@ -69,7 +69,7 @@ describe('usePluralForm', () => {
|
|||
expect(mockUsePluralForm().selectMessage(1, 'one|many')).toBe('one');
|
||||
expect(mockUsePluralForm().selectMessage(10, 'one|many')).toBe('many');
|
||||
expect(consoleMock.mock.calls[0][0]).toMatchInlineSnapshot(`
|
||||
"Failed to use Intl.PluralRules for locale \\"zh-Hans\\".
|
||||
"Failed to use Intl.PluralRules for locale "zh-Hans".
|
||||
Docusaurus will fallback to the default (English) implementation.
|
||||
Error: pluralRules.resolvedOptions is not a function
|
||||
"
|
||||
|
|
|
@ -77,7 +77,7 @@ describe('validateThemeConfig', () => {
|
|||
expect(() =>
|
||||
testValidateThemeConfig({liveCodeBlock}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"liveCodeBlock.playgroundPosition\\" must be one of [top, bottom]"`,
|
||||
`""liveCodeBlock.playgroundPosition" must be one of [top, bottom]"`,
|
||||
);
|
||||
});
|
||||
it('playgroundPosition invalid boolean', () => {
|
||||
|
@ -85,7 +85,7 @@ describe('validateThemeConfig', () => {
|
|||
expect(() =>
|
||||
testValidateThemeConfig({liveCodeBlock}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"liveCodeBlock.playgroundPosition\\" must be one of [top, bottom]"`,
|
||||
`""liveCodeBlock.playgroundPosition" must be one of [top, bottom]"`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -56,33 +56,27 @@ describe('validateThemeConfig', () => {
|
|||
const algolia = undefined;
|
||||
expect(() =>
|
||||
testValidateThemeConfig({algolia}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"themeConfig.algolia\\" is required"`,
|
||||
);
|
||||
).toThrowErrorMatchingInlineSnapshot(`""themeConfig.algolia" is required"`);
|
||||
});
|
||||
|
||||
it('undefined config 2', () => {
|
||||
expect(() =>
|
||||
testValidateThemeConfig({}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"themeConfig.algolia\\" is required"`,
|
||||
);
|
||||
).toThrowErrorMatchingInlineSnapshot(`""themeConfig.algolia" is required"`);
|
||||
});
|
||||
|
||||
it('missing indexName config', () => {
|
||||
const algolia = {apiKey: 'apiKey', appId: 'BH4D9OD16A'};
|
||||
expect(() =>
|
||||
testValidateThemeConfig({algolia}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"algolia.indexName\\" is required"`,
|
||||
);
|
||||
).toThrowErrorMatchingInlineSnapshot(`""algolia.indexName" is required"`);
|
||||
});
|
||||
|
||||
it('missing apiKey config', () => {
|
||||
const algolia = {indexName: 'indexName', appId: 'BH4D9OD16A'};
|
||||
expect(() =>
|
||||
testValidateThemeConfig({algolia}),
|
||||
).toThrowErrorMatchingInlineSnapshot(`"\\"algolia.apiKey\\" is required"`);
|
||||
).toThrowErrorMatchingInlineSnapshot(`""algolia.apiKey" is required"`);
|
||||
});
|
||||
|
||||
it('missing appId config', () => {
|
||||
|
@ -90,7 +84,7 @@ describe('validateThemeConfig', () => {
|
|||
expect(() =>
|
||||
testValidateThemeConfig({algolia}),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"algolia.appId\\" is required. If you haven't migrated to the new DocSearch infra, please refer to the blog post for instructions: https://docusaurus.io/blog/2021/11/21/algolia-docsearch-migration"`,
|
||||
`""algolia.appId" is required. If you haven't migrated to the new DocSearch infra, please refer to the blog post for instructions: https://docusaurus.io/blog/2021/11/21/algolia-docsearch-migration"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ describe('extractThemeCodeMessages', () => {
|
|||
Please make sure all theme translations are static!
|
||||
Some warnings were found!
|
||||
|
||||
Translate content could not be extracted. It has to be a static string and use optional but static props, like <Translate id=\\"my-id\\" description=\\"my-description\\">text</Translate>.
|
||||
Translate content could not be extracted. It has to be a static string and use optional but static props, like <Translate id="my-id" description="my-description">text</Translate>.
|
||||
File: packages/docusaurus-theme-translations/src/__tests__/__fixtures__/theme/index.js at line 4
|
||||
Full code: <Translate>{index}</Translate>
|
||||
"
|
||||
|
|
|
@ -1,103 +1,103 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`validation schemas admonitionsSchema: for value=[] 1`] = `"\\"value\\" must be of type object"`;
|
||||
exports[`validation schemas admonitionsSchema: for value=[] 1`] = `""value" must be of type object"`;
|
||||
|
||||
exports[`validation schemas admonitionsSchema: for value=3 1`] = `"\\"value\\" must be of type object"`;
|
||||
exports[`validation schemas admonitionsSchema: for value=3 1`] = `""value" must be of type object"`;
|
||||
|
||||
exports[`validation schemas admonitionsSchema: for value=null 1`] = `"\\"value\\" must be of type object"`;
|
||||
exports[`validation schemas admonitionsSchema: for value=null 1`] = `""value" must be of type object"`;
|
||||
|
||||
exports[`validation schemas admonitionsSchema: for value=true 1`] = `"\\"value\\" must be of type object"`;
|
||||
exports[`validation schemas admonitionsSchema: for value=true 1`] = `""value" must be of type object"`;
|
||||
|
||||
exports[`validation schemas pathnameSchema: for value="foo" 1`] = `"\\"value\\" is not a valid pathname. Pathname should start with slash and not contain any domain or query string."`;
|
||||
exports[`validation schemas pathnameSchema: for value="foo" 1`] = `""value" is not a valid pathname. Pathname should start with slash and not contain any domain or query string."`;
|
||||
|
||||
exports[`validation schemas pathnameSchema: for value="https://github.com/foo" 1`] = `"\\"value\\" is not a valid pathname. Pathname should start with slash and not contain any domain or query string."`;
|
||||
exports[`validation schemas pathnameSchema: for value="https://github.com/foo" 1`] = `""value" is not a valid pathname. Pathname should start with slash and not contain any domain or query string."`;
|
||||
|
||||
exports[`validation schemas pluginIdSchema: for value="/docs" 1`] = `"Illegal plugin ID value \\"/docs\\": it should only contain alphanumerics, underscores, and dashes."`;
|
||||
exports[`validation schemas pluginIdSchema: for value="/docs" 1`] = `"Illegal plugin ID value "/docs": it should only contain alphanumerics, underscores, and dashes."`;
|
||||
|
||||
exports[`validation schemas pluginIdSchema: for value="do cs" 1`] = `"Illegal plugin ID value \\"do cs\\": it should only contain alphanumerics, underscores, and dashes."`;
|
||||
exports[`validation schemas pluginIdSchema: for value="do cs" 1`] = `"Illegal plugin ID value "do cs": it should only contain alphanumerics, underscores, and dashes."`;
|
||||
|
||||
exports[`validation schemas pluginIdSchema: for value="do/cs" 1`] = `"Illegal plugin ID value \\"do/cs\\": it should only contain alphanumerics, underscores, and dashes."`;
|
||||
exports[`validation schemas pluginIdSchema: for value="do/cs" 1`] = `"Illegal plugin ID value "do/cs": it should only contain alphanumerics, underscores, and dashes."`;
|
||||
|
||||
exports[`validation schemas pluginIdSchema: for value="docs/" 1`] = `"Illegal plugin ID value \\"docs/\\": it should only contain alphanumerics, underscores, and dashes."`;
|
||||
exports[`validation schemas pluginIdSchema: for value="docs/" 1`] = `"Illegal plugin ID value "docs/": it should only contain alphanumerics, underscores, and dashes."`;
|
||||
|
||||
exports[`validation schemas pluginIdSchema: for value=[] 1`] = `"\\"value\\" must be a string"`;
|
||||
exports[`validation schemas pluginIdSchema: for value=[] 1`] = `""value" must be a string"`;
|
||||
|
||||
exports[`validation schemas pluginIdSchema: for value=3 1`] = `"\\"value\\" must be a string"`;
|
||||
exports[`validation schemas pluginIdSchema: for value=3 1`] = `""value" must be a string"`;
|
||||
|
||||
exports[`validation schemas pluginIdSchema: for value=null 1`] = `"\\"value\\" must be a string"`;
|
||||
exports[`validation schemas pluginIdSchema: for value=null 1`] = `""value" must be a string"`;
|
||||
|
||||
exports[`validation schemas pluginIdSchema: for value=true 1`] = `"\\"value\\" must be a string"`;
|
||||
exports[`validation schemas pluginIdSchema: for value=true 1`] = `""value" must be a string"`;
|
||||
|
||||
exports[`validation schemas rehypePluginsSchema: for value=[[]] 1`] = `
|
||||
"\\"[0]\\" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require(\\"rehype-katex\\"), { strict: false }]\`, or
|
||||
- A simple module, like \`require(\\"remark-math\\")\`"
|
||||
""[0]" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require("rehype-katex"), { strict: false }]\`, or
|
||||
- A simple module, like \`require("remark-math")\`"
|
||||
`;
|
||||
|
||||
exports[`validation schemas rehypePluginsSchema: for value=[[null,null]] 1`] = `
|
||||
"\\"[0]\\" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require(\\"rehype-katex\\"), { strict: false }]\`, or
|
||||
- A simple module, like \`require(\\"remark-math\\")\`"
|
||||
""[0]" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require("rehype-katex"), { strict: false }]\`, or
|
||||
- A simple module, like \`require("remark-math")\`"
|
||||
`;
|
||||
|
||||
exports[`validation schemas rehypePluginsSchema: for value=[3] 1`] = `
|
||||
"\\"[0]\\" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require(\\"rehype-katex\\"), { strict: false }]\`, or
|
||||
- A simple module, like \`require(\\"remark-math\\")\`"
|
||||
""[0]" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require("rehype-katex"), { strict: false }]\`, or
|
||||
- A simple module, like \`require("remark-math")\`"
|
||||
`;
|
||||
|
||||
exports[`validation schemas rehypePluginsSchema: for value=[false] 1`] = `
|
||||
"\\"[0]\\" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require(\\"rehype-katex\\"), { strict: false }]\`, or
|
||||
- A simple module, like \`require(\\"remark-math\\")\`"
|
||||
""[0]" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require("rehype-katex"), { strict: false }]\`, or
|
||||
- A simple module, like \`require("remark-math")\`"
|
||||
`;
|
||||
|
||||
exports[`validation schemas rehypePluginsSchema: for value=[null] 1`] = `
|
||||
"\\"[0]\\" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require(\\"rehype-katex\\"), { strict: false }]\`, or
|
||||
- A simple module, like \`require(\\"remark-math\\")\`"
|
||||
""[0]" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require("rehype-katex"), { strict: false }]\`, or
|
||||
- A simple module, like \`require("remark-math")\`"
|
||||
`;
|
||||
|
||||
exports[`validation schemas rehypePluginsSchema: for value=3 1`] = `"\\"value\\" must be an array"`;
|
||||
exports[`validation schemas rehypePluginsSchema: for value=3 1`] = `""value" must be an array"`;
|
||||
|
||||
exports[`validation schemas rehypePluginsSchema: for value=false 1`] = `"\\"value\\" must be an array"`;
|
||||
exports[`validation schemas rehypePluginsSchema: for value=false 1`] = `""value" must be an array"`;
|
||||
|
||||
exports[`validation schemas rehypePluginsSchema: for value=null 1`] = `"\\"value\\" must be an array"`;
|
||||
exports[`validation schemas rehypePluginsSchema: for value=null 1`] = `""value" must be an array"`;
|
||||
|
||||
exports[`validation schemas remarkPluginsSchema: for value=[[]] 1`] = `
|
||||
"\\"[0]\\" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require(\\"rehype-katex\\"), { strict: false }]\`, or
|
||||
- A simple module, like \`require(\\"remark-math\\")\`"
|
||||
""[0]" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require("rehype-katex"), { strict: false }]\`, or
|
||||
- A simple module, like \`require("remark-math")\`"
|
||||
`;
|
||||
|
||||
exports[`validation schemas remarkPluginsSchema: for value=[[null,null]] 1`] = `
|
||||
"\\"[0]\\" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require(\\"rehype-katex\\"), { strict: false }]\`, or
|
||||
- A simple module, like \`require(\\"remark-math\\")\`"
|
||||
""[0]" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require("rehype-katex"), { strict: false }]\`, or
|
||||
- A simple module, like \`require("remark-math")\`"
|
||||
`;
|
||||
|
||||
exports[`validation schemas remarkPluginsSchema: for value=[3] 1`] = `
|
||||
"\\"[0]\\" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require(\\"rehype-katex\\"), { strict: false }]\`, or
|
||||
- A simple module, like \`require(\\"remark-math\\")\`"
|
||||
""[0]" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require("rehype-katex"), { strict: false }]\`, or
|
||||
- A simple module, like \`require("remark-math")\`"
|
||||
`;
|
||||
|
||||
exports[`validation schemas remarkPluginsSchema: for value=[false] 1`] = `
|
||||
"\\"[0]\\" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require(\\"rehype-katex\\"), { strict: false }]\`, or
|
||||
- A simple module, like \`require(\\"remark-math\\")\`"
|
||||
""[0]" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require("rehype-katex"), { strict: false }]\`, or
|
||||
- A simple module, like \`require("remark-math")\`"
|
||||
`;
|
||||
|
||||
exports[`validation schemas remarkPluginsSchema: for value=[null] 1`] = `
|
||||
"\\"[0]\\" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require(\\"rehype-katex\\"), { strict: false }]\`, or
|
||||
- A simple module, like \`require(\\"remark-math\\")\`"
|
||||
""[0]" does not look like a valid MDX plugin config. A plugin config entry should be one of:
|
||||
- A tuple, like \`[require("rehype-katex"), { strict: false }]\`, or
|
||||
- A simple module, like \`require("remark-math")\`"
|
||||
`;
|
||||
|
||||
exports[`validation schemas remarkPluginsSchema: for value=3 1`] = `"\\"value\\" must be an array"`;
|
||||
exports[`validation schemas remarkPluginsSchema: for value=3 1`] = `""value" must be an array"`;
|
||||
|
||||
exports[`validation schemas remarkPluginsSchema: for value=false 1`] = `"\\"value\\" must be an array"`;
|
||||
exports[`validation schemas remarkPluginsSchema: for value=false 1`] = `""value" must be an array"`;
|
||||
|
||||
exports[`validation schemas remarkPluginsSchema: for value=null 1`] = `"\\"value\\" must be an array"`;
|
||||
exports[`validation schemas remarkPluginsSchema: for value=null 1`] = `""value" must be an array"`;
|
||||
|
||||
exports[`validation schemas uRISchema: for value="spaces are invalid in a URL" 1`] = `"\\"value\\" does not look like a valid url (value='')"`;
|
||||
exports[`validation schemas uRISchema: for value="spaces are invalid in a URL" 1`] = `""value" does not look like a valid url (value='')"`;
|
||||
|
|
|
@ -43,7 +43,7 @@ describe('normalizePluginOptions', () => {
|
|||
const options = {foo: 1};
|
||||
expect(() =>
|
||||
normalizePluginOptions(Joi.object({foo: Joi.string()}), options),
|
||||
).toThrowErrorMatchingInlineSnapshot(`"\\"foo\\" must be a string"`);
|
||||
).toThrowErrorMatchingInlineSnapshot(`""foo" must be a string"`);
|
||||
});
|
||||
|
||||
it('warns', () => {
|
||||
|
@ -91,7 +91,7 @@ describe('normalizeThemeConfig', () => {
|
|||
const themeConfig = {foo: 1, bar: 1};
|
||||
expect(() =>
|
||||
normalizeThemeConfig(Joi.object({foo: Joi.string()}), themeConfig),
|
||||
).toThrowErrorMatchingInlineSnapshot(`"\\"foo\\" must be a string"`);
|
||||
).toThrowErrorMatchingInlineSnapshot(`""foo" must be a string"`);
|
||||
});
|
||||
|
||||
it('warns', () => {
|
||||
|
@ -136,7 +136,7 @@ describe('validateFrontMatter', () => {
|
|||
};
|
||||
expect(() =>
|
||||
validateFrontMatter(frontMatter, schema),
|
||||
).toThrowErrorMatchingInlineSnapshot(`"\\"test\\" must be a string"`);
|
||||
).toThrowErrorMatchingInlineSnapshot(`""test" must be a string"`);
|
||||
expect(consoleError).toHaveBeenCalledWith(
|
||||
expect.stringContaining('The following front matter'),
|
||||
);
|
||||
|
|
|
@ -202,7 +202,7 @@ describe('getFolderContainingFile', () => {
|
|||
'dataFileUtils.test.ts',
|
||||
),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(`
|
||||
"File \\"dataFileUtils.test.ts\\" does not exist in any of these folders:
|
||||
"File "dataFileUtils.test.ts" does not exist in any of these folders:
|
||||
- /foo
|
||||
- /bar
|
||||
- /baz"
|
||||
|
|
|
@ -131,7 +131,7 @@ describe('reportMessage', () => {
|
|||
// @ts-expect-error: for test
|
||||
reportMessage('hey', 'foo'),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Unexpected \\"reportingSeverity\\" value: foo."`,
|
||||
`"Unexpected "reportingSeverity" value: foo."`,
|
||||
);
|
||||
expect(consoleLog).toBeCalledTimes(1);
|
||||
expect(consoleLog).toBeCalledWith(
|
||||
|
|
|
@ -40,7 +40,7 @@ describe('<BrowserOnly>', () => {
|
|||
)
|
||||
.toJSON(),
|
||||
).toThrowErrorMatchingInlineSnapshot(`
|
||||
"Docusaurus error: The children of <BrowserOnly> must be a \\"render function\\", e.g. <BrowserOnly>{() => <span>{window.location.href}</span>}</BrowserOnly>.
|
||||
"Docusaurus error: The children of <BrowserOnly> must be a "render function", e.g. <BrowserOnly>{() => <span>{window.location.href}</span>}</BrowserOnly>.
|
||||
Current type: React element"
|
||||
`);
|
||||
});
|
||||
|
@ -55,7 +55,7 @@ describe('<BrowserOnly>', () => {
|
|||
</Context.Provider>,
|
||||
);
|
||||
}).toThrowErrorMatchingInlineSnapshot(`
|
||||
"Docusaurus error: The children of <BrowserOnly> must be a \\"render function\\", e.g. <BrowserOnly>{() => <span>{window.location.href}</span>}</BrowserOnly>.
|
||||
"Docusaurus error: The children of <BrowserOnly> must be a "render function", e.g. <BrowserOnly>{() => <span>{window.location.href}</span>}</BrowserOnly>.
|
||||
Current type: string"
|
||||
`);
|
||||
});
|
||||
|
|
|
@ -69,7 +69,7 @@ describe('useAllPluginInstancesData', () => {
|
|||
),
|
||||
}).result.current,
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Docusaurus plugin global data not found for \\"bar\\" plugin."`,
|
||||
`"Docusaurus plugin global data not found for "bar" plugin."`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -116,7 +116,7 @@ describe('usePluginData', () => {
|
|||
),
|
||||
}).result.current,
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Docusaurus plugin global data not found for \\"foo\\" plugin with id \\"baz\\"."`,
|
||||
`"Docusaurus plugin global data not found for "foo" plugin with id "baz"."`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -66,7 +66,7 @@ describe('normalizeSwizzleConfig', () => {
|
|||
expect(() =>
|
||||
normalizeSwizzleConfig(config),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Swizzle config does not match expected schema: \\"components\\" is required"`,
|
||||
`"Swizzle config does not match expected schema: "components" is required"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -87,7 +87,7 @@ describe('normalizeSwizzleConfig', () => {
|
|||
expect(() =>
|
||||
normalizeSwizzleConfig(config),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Swizzle config does not match expected schema: \\"components.MyComponent.actions.bad\\" is not allowed"`,
|
||||
`"Swizzle config does not match expected schema: "components.MyComponent.actions.bad" is not allowed"`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -107,7 +107,7 @@ describe('normalizeSwizzleConfig', () => {
|
|||
expect(() =>
|
||||
normalizeSwizzleConfig(config),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Swizzle config does not match expected schema: \\"components.MyComponent.actions.eject\\" must be one of [safe, unsafe, forbidden]"`,
|
||||
`"Swizzle config does not match expected schema: "components.MyComponent.actions.eject" must be one of [safe, unsafe, forbidden]"`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -5,9 +5,9 @@ exports[`normalizeConfig should throw error if plugins is not a string and it's
|
|||
Example valid plugin config:
|
||||
{
|
||||
plugins: [
|
||||
[\\"@docusaurus/plugin-content-docs\\",options],
|
||||
\\"./myPlugin\\",
|
||||
[\\"./myPlugin\\",{someOption: 42}],
|
||||
["@docusaurus/plugin-content-docs",options],
|
||||
"./myPlugin",
|
||||
["./myPlugin",{someOption: 42}],
|
||||
function myPlugin() { },
|
||||
[function myPlugin() { },options]
|
||||
],
|
||||
|
@ -21,9 +21,9 @@ exports[`normalizeConfig should throw error if plugins is not an array of [strin
|
|||
Example valid plugin config:
|
||||
{
|
||||
plugins: [
|
||||
[\\"@docusaurus/plugin-content-docs\\",options],
|
||||
\\"./myPlugin\\",
|
||||
[\\"./myPlugin\\",{someOption: 42}],
|
||||
["@docusaurus/plugin-content-docs",options],
|
||||
"./myPlugin",
|
||||
["./myPlugin",{someOption: 42}],
|
||||
function myPlugin() { },
|
||||
[function myPlugin() { },options]
|
||||
],
|
||||
|
@ -37,9 +37,9 @@ exports[`normalizeConfig should throw error if plugins is not an array of [strin
|
|||
Example valid plugin config:
|
||||
{
|
||||
plugins: [
|
||||
[\\"@docusaurus/plugin-content-docs\\",options],
|
||||
\\"./myPlugin\\",
|
||||
[\\"./myPlugin\\",{someOption: 42}],
|
||||
["@docusaurus/plugin-content-docs",options],
|
||||
"./myPlugin",
|
||||
["./myPlugin",{someOption: 42}],
|
||||
function myPlugin() { },
|
||||
[function myPlugin() { },options]
|
||||
],
|
||||
|
@ -53,9 +53,9 @@ exports[`normalizeConfig should throw error if plugins is not an array of [strin
|
|||
Example valid plugin config:
|
||||
{
|
||||
plugins: [
|
||||
[\\"@docusaurus/plugin-content-docs\\",options],
|
||||
\\"./myPlugin\\",
|
||||
[\\"./myPlugin\\",{someOption: 42}],
|
||||
["@docusaurus/plugin-content-docs",options],
|
||||
"./myPlugin",
|
||||
["./myPlugin",{someOption: 42}],
|
||||
function myPlugin() { },
|
||||
[function myPlugin() { },options]
|
||||
],
|
||||
|
@ -65,7 +65,7 @@ Example valid plugin config:
|
|||
`;
|
||||
|
||||
exports[`normalizeConfig should throw error if plugins is not array for the input of: {} 1`] = `
|
||||
"\\"plugins\\" must be an array
|
||||
""plugins" must be an array
|
||||
"
|
||||
`;
|
||||
|
||||
|
@ -74,9 +74,9 @@ exports[`normalizeConfig should throw error if themes is not a string and it's n
|
|||
Example valid theme config:
|
||||
{
|
||||
themes: [
|
||||
[\\"@docusaurus/theme-classic\\",options],
|
||||
\\"./myTheme\\",
|
||||
[\\"./myTheme\\",{someOption: 42}],
|
||||
["@docusaurus/theme-classic",options],
|
||||
"./myTheme",
|
||||
["./myTheme",{someOption: 42}],
|
||||
function myTheme() { },
|
||||
[function myTheme() { },options]
|
||||
],
|
||||
|
@ -90,9 +90,9 @@ exports[`normalizeConfig should throw error if themes is not an array of [string
|
|||
Example valid theme config:
|
||||
{
|
||||
themes: [
|
||||
[\\"@docusaurus/theme-classic\\",options],
|
||||
\\"./myTheme\\",
|
||||
[\\"./myTheme\\",{someOption: 42}],
|
||||
["@docusaurus/theme-classic",options],
|
||||
"./myTheme",
|
||||
["./myTheme",{someOption: 42}],
|
||||
function myTheme() { },
|
||||
[function myTheme() { },options]
|
||||
],
|
||||
|
@ -106,9 +106,9 @@ exports[`normalizeConfig should throw error if themes is not an array of [string
|
|||
Example valid theme config:
|
||||
{
|
||||
themes: [
|
||||
[\\"@docusaurus/theme-classic\\",options],
|
||||
\\"./myTheme\\",
|
||||
[\\"./myTheme\\",{someOption: 42}],
|
||||
["@docusaurus/theme-classic",options],
|
||||
"./myTheme",
|
||||
["./myTheme",{someOption: 42}],
|
||||
function myTheme() { },
|
||||
[function myTheme() { },options]
|
||||
],
|
||||
|
@ -122,9 +122,9 @@ exports[`normalizeConfig should throw error if themes is not an array of [string
|
|||
Example valid theme config:
|
||||
{
|
||||
themes: [
|
||||
[\\"@docusaurus/theme-classic\\",options],
|
||||
\\"./myTheme\\",
|
||||
[\\"./myTheme\\",{someOption: 42}],
|
||||
["@docusaurus/theme-classic",options],
|
||||
"./myTheme",
|
||||
["./myTheme",{someOption: 42}],
|
||||
function myTheme() { },
|
||||
[function myTheme() { },options]
|
||||
],
|
||||
|
@ -134,30 +134,30 @@ Example valid theme config:
|
|||
`;
|
||||
|
||||
exports[`normalizeConfig should throw error if themes is not array for the input of: {} 1`] = `
|
||||
"\\"themes\\" must be an array
|
||||
""themes" must be an array
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`normalizeConfig throws error for baseUrl without trailing \`/\` 1`] = `
|
||||
"\\"baseUrl\\" must be a string with a trailing slash.
|
||||
""baseUrl" must be a string with a trailing slash.
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`normalizeConfig throws error for required fields 1`] = `
|
||||
"\\"baseUrl\\" is required
|
||||
\\"title\\" is required
|
||||
\\"url\\" is required
|
||||
\\"themes\\" must be an array
|
||||
\\"presets\\" must be an array
|
||||
\\"scripts\\" must be an array
|
||||
\\"stylesheets\\" must be an array
|
||||
These field(s) (\\"invalidField\\",) are not recognized in docusaurus.config.js.
|
||||
If you still want these fields to be in your configuration, put them in the \\"customFields\\" field.
|
||||
""baseUrl" is required
|
||||
"title" is required
|
||||
"url" is required
|
||||
"themes" must be an array
|
||||
"presets" must be an array
|
||||
"scripts" must be an array
|
||||
"stylesheets" must be an array
|
||||
These field(s) ("invalidField",) are not recognized in docusaurus.config.js.
|
||||
If you still want these fields to be in your configuration, put them in the "customFields" field.
|
||||
See https://docusaurus.io/docs/api/docusaurus-config/#customfields"
|
||||
`;
|
||||
|
||||
exports[`normalizeConfig throws error for unknown field 1`] = `
|
||||
"These field(s) (\\"invalid\\",) are not recognized in docusaurus.config.js.
|
||||
If you still want these fields to be in your configuration, put them in the \\"customFields\\" field.
|
||||
"These field(s) ("invalid",) are not recognized in docusaurus.config.js.
|
||||
If you still want these fields to be in your configuration, put them in the "customFields" field.
|
||||
See https://docusaurus.io/docs/api/docusaurus-config/#customfields"
|
||||
`;
|
||||
|
|
|
@ -102,17 +102,17 @@ export default [
|
|||
path: '/docs/hello',
|
||||
component: ComponentCreator('/docs/hello', 'fcc'),
|
||||
exact: true,
|
||||
sidebar: \\"main\\"
|
||||
sidebar: "main"
|
||||
},
|
||||
{
|
||||
path: 'docs/foo/baz',
|
||||
component: ComponentCreator('docs/foo/baz', 'eb2'),
|
||||
sidebar: \\"secondary\\",
|
||||
\\"key:a\\": \\"containing colon\\",
|
||||
\\"key'b\\": \\"containing quote\\",
|
||||
\\"key\\\\\\"c\\": \\"containing double quote\\",
|
||||
\\"key,d\\": \\"containing comma\\",
|
||||
字段: \\"containing unicode\\"
|
||||
sidebar: "secondary",
|
||||
"key:a": "containing colon",
|
||||
"key'b": "containing quote",
|
||||
"key\\"c": "containing double quote",
|
||||
"key,d": "containing comma",
|
||||
字段: "containing unicode"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -53,7 +53,7 @@ describe('loadSiteConfig', () => {
|
|||
customConfigFilePath: 'incomplete.config.js',
|
||||
}),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(`
|
||||
"\\"url\\" is required
|
||||
""url" is required
|
||||
"
|
||||
`);
|
||||
});
|
||||
|
@ -65,8 +65,8 @@ describe('loadSiteConfig', () => {
|
|||
customConfigFilePath: 'wrong.config.js',
|
||||
}),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(`
|
||||
"These field(s) (\\"useLessField\\",) are not recognized in docusaurus.config.js.
|
||||
If you still want these fields to be in your configuration, put them in the \\"customFields\\" field.
|
||||
"These field(s) ("useLessField",) are not recognized in docusaurus.config.js.
|
||||
If you still want these fields to be in your configuration, put them in the "customFields" field.
|
||||
See https://docusaurus.io/docs/api/docusaurus-config/#customfields"
|
||||
`);
|
||||
});
|
||||
|
@ -78,7 +78,7 @@ describe('loadSiteConfig', () => {
|
|||
customConfigFilePath: 'nonExistent.config.js',
|
||||
}),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"Config file at \\"<PROJECT_ROOT>/packages/docusaurus/src/server/__tests__/__fixtures__/config/nonExistent.config.js\\" not found."`,
|
||||
`"Config file at "<PROJECT_ROOT>/packages/docusaurus/src/server/__tests__/__fixtures__/config/nonExistent.config.js" not found."`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -227,7 +227,7 @@ describe('normalizeConfig', () => {
|
|||
themes: {},
|
||||
});
|
||||
}).toThrowErrorMatchingInlineSnapshot(`
|
||||
"\\"themes\\" must be an array
|
||||
""themes" must be an array
|
||||
"
|
||||
`);
|
||||
});
|
||||
|
@ -238,7 +238,7 @@ describe('normalizeConfig', () => {
|
|||
presets: {},
|
||||
});
|
||||
}).toThrowErrorMatchingInlineSnapshot(`
|
||||
"\\"presets\\" must be an array
|
||||
""presets" must be an array
|
||||
"
|
||||
`);
|
||||
});
|
||||
|
@ -249,9 +249,9 @@ describe('normalizeConfig', () => {
|
|||
presets: [() => {}],
|
||||
});
|
||||
}).toThrowErrorMatchingInlineSnapshot(`
|
||||
"\\"presets[0]\\" does not look like a valid preset config. A preset config entry should be one of:
|
||||
- A tuple of [presetName, options], like \`[\\"classic\\", { blog: false }]\`, or
|
||||
- A simple string, like \`\\"classic\\"\`
|
||||
""presets[0]" does not look like a valid preset config. A preset config entry should be one of:
|
||||
- A tuple of [presetName, options], like \`["classic", { blog: false }]\`, or
|
||||
- A simple string, like \`"classic"\`
|
||||
"
|
||||
`);
|
||||
});
|
||||
|
@ -270,7 +270,7 @@ describe('normalizeConfig', () => {
|
|||
scripts: ['https://some.com', {}],
|
||||
});
|
||||
}).toThrowErrorMatchingInlineSnapshot(`
|
||||
"\\"scripts[1]\\" is invalid. A script must be a plain string (the src), or an object with at least a \\"src\\" property.
|
||||
""scripts[1]" is invalid. A script must be a plain string (the src), or an object with at least a "src" property.
|
||||
"
|
||||
`);
|
||||
});
|
||||
|
@ -281,7 +281,7 @@ describe('normalizeConfig', () => {
|
|||
stylesheets: ['https://somescript.com', {type: 'text/css'}],
|
||||
});
|
||||
}).toThrowErrorMatchingInlineSnapshot(`
|
||||
"\\"stylesheets[1]\\" is invalid. A stylesheet must be a plain string (the href), or an object with at least a \\"href\\" property.
|
||||
""stylesheets[1]" is invalid. A stylesheet must be a plain string (the href), or an object with at least a "href" property.
|
||||
"
|
||||
`);
|
||||
});
|
||||
|
@ -318,7 +318,7 @@ describe('config warnings', () => {
|
|||
expect(warning).toBeDefined();
|
||||
expect(warning.details).toHaveLength(1);
|
||||
expect(warning.details[0].message).toMatchInlineSnapshot(
|
||||
`"Docusaurus config validation warning. Field \\"url\\": the url is not supposed to contain a sub-path like '/someSubpath', please use the baseUrl field for sub-paths"`,
|
||||
`"Docusaurus config validation warning. Field "url": the url is not supposed to contain a sub-path like '/someSubpath', please use the baseUrl field for sub-paths"`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -99,9 +99,9 @@ describe('loadHtmlTags', () => {
|
|||
const htmlTags = loadHtmlTags([pluginHeadTags]);
|
||||
expect(htmlTags).toMatchInlineSnapshot(`
|
||||
{
|
||||
"headTags": "<link rel=\\"preconnect\\" href=\\"www.google-analytics.com\\">
|
||||
<meta name=\\"generator\\" content=\\"Docusaurus\\">
|
||||
<script type=\\"text/javascript\\" src=\\"https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js\\" async data-options=\\"{"prop":true}\\"></script>",
|
||||
"headTags": "<link rel="preconnect" href="www.google-analytics.com">
|
||||
<meta name="generator" content="Docusaurus">
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js" async data-options="{"prop":true}"></script>",
|
||||
"postBodyTags": "",
|
||||
"preBodyTags": "",
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ describe('loadHtmlTags', () => {
|
|||
{
|
||||
"headTags": "",
|
||||
"postBodyTags": "",
|
||||
"preBodyTags": "<script type=\\"text/javascript\\">window.foo = null;</script>",
|
||||
"preBodyTags": "<script type="text/javascript">window.foo = null;</script>",
|
||||
}
|
||||
`);
|
||||
});
|
||||
|
@ -139,12 +139,12 @@ describe('loadHtmlTags', () => {
|
|||
]);
|
||||
expect(htmlTags).toMatchInlineSnapshot(`
|
||||
{
|
||||
"headTags": "<link rel=\\"preconnect\\" href=\\"www.google-analytics.com\\">
|
||||
<meta name=\\"generator\\" content=\\"Docusaurus\\">
|
||||
<script type=\\"text/javascript\\" src=\\"https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js\\" async data-options=\\"{"prop":true}\\"></script>",
|
||||
"headTags": "<link rel="preconnect" href="www.google-analytics.com">
|
||||
<meta name="generator" content="Docusaurus">
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js" async data-options="{"prop":true}"></script>",
|
||||
"postBodyTags": "<div>Test content</div>
|
||||
<script>window.alert(1);</script>",
|
||||
"preBodyTags": "<script type=\\"text/javascript\\">window.foo = null;</script>",
|
||||
"preBodyTags": "<script type="text/javascript">window.foo = null;</script>",
|
||||
}
|
||||
`);
|
||||
});
|
||||
|
@ -158,9 +158,9 @@ describe('loadHtmlTags', () => {
|
|||
]);
|
||||
expect(htmlTags).toMatchInlineSnapshot(`
|
||||
{
|
||||
"headTags": "<link rel=\\"preconnect\\" href=\\"www.google-analytics.com\\">
|
||||
<meta name=\\"generator\\" content=\\"Docusaurus\\">
|
||||
<script type=\\"text/javascript\\" src=\\"https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js\\" async data-options=\\"{"prop":true}\\"></script>",
|
||||
"headTags": "<link rel="preconnect" href="www.google-analytics.com">
|
||||
<meta name="generator" content="Docusaurus">
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js" async data-options="{"prop":true}"></script>",
|
||||
"postBodyTags": "<div>Test content</div>
|
||||
<script>window.alert(1);</script>",
|
||||
"preBodyTags": "",
|
||||
|
@ -184,7 +184,7 @@ describe('loadHtmlTags', () => {
|
|||
},
|
||||
]),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"Error loading {\\"tagName\\":\\"endiliey\\",\\"attributes\\":{\\"this\\":\\"is invalid\\"}}, \\"endiliey\\" is not a valid HTML tag."`,
|
||||
`"Error loading {"tagName":"endiliey","attributes":{"this":"is invalid"}}, "endiliey" is not a valid HTML tag."`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -202,7 +202,7 @@ describe('loadHtmlTags', () => {
|
|||
},
|
||||
]),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"{\\"tagName\\":true} is not a valid HTML tag object. \\"tagName\\" must be defined as a string."`,
|
||||
`"{"tagName":true} is not a valid HTML tag object. "tagName" must be defined as a string."`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -218,7 +218,7 @@ describe('loadHtmlTags', () => {
|
|||
},
|
||||
]),
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"2\\" is not a valid HTML tag object."`,
|
||||
`""2" is not a valid HTML tag object."`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -183,9 +183,9 @@ describe('loadRoutes', () => {
|
|||
|
||||
expect(() => loadRoutes([routeConfigWithoutPath], '/', 'ignore'))
|
||||
.toThrowErrorMatchingInlineSnapshot(`
|
||||
"Invalid route config: path must be a string and component is required.
|
||||
{\\"component\\":\\"hello/world.js\\"}"
|
||||
`);
|
||||
"Invalid route config: path must be a string and component is required.
|
||||
{"component":"hello/world.js"}"
|
||||
`);
|
||||
|
||||
const routeConfigWithoutComponent = {
|
||||
path: '/hello/world',
|
||||
|
@ -193,9 +193,9 @@ describe('loadRoutes', () => {
|
|||
|
||||
expect(() => loadRoutes([routeConfigWithoutComponent], '/', 'ignore'))
|
||||
.toThrowErrorMatchingInlineSnapshot(`
|
||||
"Invalid route config: path must be a string and component is required.
|
||||
{\\"path\\":\\"/hello/world\\"}"
|
||||
`);
|
||||
"Invalid route config: path must be a string and component is required.
|
||||
{"path":"/hello/world"}"
|
||||
`);
|
||||
});
|
||||
|
||||
it('loads route config with empty (but valid) path string', () => {
|
||||
|
|
|
@ -55,11 +55,10 @@ describe('loadSiteMetadata', () => {
|
|||
siteDir: path.join(__dirname, '__fixtures__/siteMetadata'),
|
||||
}),
|
||||
).resolves.toMatchSnapshot();
|
||||
// cSpell:ignore mdocusaurus
|
||||
expect(consoleMock.mock.calls[0][0]).toMatchInlineSnapshot(`
|
||||
"[31m[1m[ERROR][22m Invalid [34m[1mdocusaurus-plugin-content-docs[22m[39m[31m version [33m1.0.0[39m[31m.[39m
|
||||
[31mAll official @docusaurus/* packages should have the exact same version as @docusaurus/core ([33m<CURRENT_VERSION>[39m[31m).[39m
|
||||
[31mMaybe you want to check, or regenerate your yarn.lock or package-lock.json file?[39m"
|
||||
"[ERROR] Invalid docusaurus-plugin-content-docs version 1.0.0.
|
||||
All official @docusaurus/* packages should have the exact same version as @docusaurus/core (<CURRENT_VERSION>).
|
||||
Maybe you want to check, or regenerate your yarn.lock or package-lock.json file?"
|
||||
`);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -5,9 +5,9 @@ exports[`initPlugins throws user-friendly error message for plugins with bad val
|
|||
Example valid plugin config:
|
||||
{
|
||||
plugins: [
|
||||
[\\"@docusaurus/plugin-content-docs\\",options],
|
||||
\\"./myPlugin\\",
|
||||
[\\"./myPlugin\\",{someOption: 42}],
|
||||
["@docusaurus/plugin-content-docs",options],
|
||||
"./myPlugin",
|
||||
["./myPlugin",{someOption: 42}],
|
||||
function myPlugin() { },
|
||||
[function myPlugin() { },options]
|
||||
],
|
||||
|
@ -17,9 +17,9 @@ Example valid plugin config:
|
|||
Example valid plugin config:
|
||||
{
|
||||
plugins: [
|
||||
[\\"@docusaurus/plugin-content-docs\\",options],
|
||||
\\"./myPlugin\\",
|
||||
[\\"./myPlugin\\",{someOption: 42}],
|
||||
["@docusaurus/plugin-content-docs",options],
|
||||
"./myPlugin",
|
||||
["./myPlugin",{someOption: 42}],
|
||||
function myPlugin() { },
|
||||
[function myPlugin() { },options]
|
||||
],
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`ensureUniquePluginInstanceIds reject multi instance plugins with same id 1`] = `
|
||||
"Plugin \\"plugin-docs\\" is used 2 times with ID \\"sameId\\".
|
||||
"Plugin "plugin-docs" is used 2 times with ID "sameId".
|
||||
To use the same plugin multiple times on a Docusaurus site, you need to assign a unique ID to each plugin instance."
|
||||
`;
|
||||
|
||||
exports[`ensureUniquePluginInstanceIds reject multi instance plugins with some without id 1`] = `
|
||||
"Plugin \\"plugin-docs\\" is used 2 times with ID \\"default\\".
|
||||
"Plugin "plugin-docs" is used 2 times with ID "default".
|
||||
To use the same plugin multiple times on a Docusaurus site, you need to assign a unique ID to each plugin instance.
|
||||
|
||||
The plugin ID is \\"default\\" by default. It's possible that the preset you are using already includes a plugin instance, in which case you either want to disable the plugin in the preset (to use a single instance), or assign another ID to your extra plugin instance (to use multiple instances)."
|
||||
The plugin ID is "default" by default. It's possible that the preset you are using already includes a plugin instance, in which case you either want to disable the plugin in the preset (to use a single instance), or assign another ID to your extra plugin instance (to use multiple instances)."
|
||||
`;
|
||||
|
||||
exports[`ensureUniquePluginInstanceIds reject multi instance plugins without id 1`] = `
|
||||
"Plugin \\"plugin-docs\\" is used 2 times with ID \\"default\\".
|
||||
"Plugin "plugin-docs" is used 2 times with ID "default".
|
||||
To use the same plugin multiple times on a Docusaurus site, you need to assign a unique ID to each plugin instance.
|
||||
|
||||
The plugin ID is \\"default\\" by default. It's possible that the preset you are using already includes a plugin instance, in which case you either want to disable the plugin in the preset (to use a single instance), or assign another ID to your extra plugin instance (to use multiple instances)."
|
||||
The plugin ID is "default" by default. It's possible that the preset you are using already includes a plugin instance, in which case you either want to disable the plugin in the preset (to use a single instance), or assign another ID to your extra plugin instance (to use multiple instances)."
|
||||
`;
|
||||
|
|
|
@ -72,7 +72,7 @@ describe('resolveModuleName', () => {
|
|||
expect(() =>
|
||||
resolveModuleName('@docusaurus/plugin-content-doc', require, 'plugin'),
|
||||
).toThrowErrorMatchingInlineSnapshot(`
|
||||
"Docusaurus was unable to resolve the \\"@docusaurus/plugin-content-doc\\" plugin. Make sure one of the following packages are installed:
|
||||
"Docusaurus was unable to resolve the "@docusaurus/plugin-content-doc" plugin. Make sure one of the following packages are installed:
|
||||
- @docusaurus/plugin-content-doc
|
||||
- @docusaurus/docusaurus-plugin-plugin-content-doc"
|
||||
`);
|
||||
|
@ -81,7 +81,7 @@ describe('resolveModuleName', () => {
|
|||
it('throws good error message for shorthand', () => {
|
||||
expect(() => resolveModuleName('content-doc', require, 'plugin'))
|
||||
.toThrowErrorMatchingInlineSnapshot(`
|
||||
"Docusaurus was unable to resolve the \\"content-doc\\" plugin. Make sure one of the following packages are installed:
|
||||
"Docusaurus was unable to resolve the "content-doc" plugin. Make sure one of the following packages are installed:
|
||||
- content-doc
|
||||
- @docusaurus/plugin-content-doc
|
||||
- docusaurus-plugin-content-doc"
|
||||
|
|
|
@ -259,10 +259,11 @@ describe('writeCodeTranslations', () => {
|
|||
{
|
||||
key1: {message: 'key1 message'},
|
||||
},
|
||||
|
||||
{},
|
||||
),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"bad\\" must be of type object"`,
|
||||
`""bad" must be of type object"`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -403,7 +404,7 @@ describe('writePluginTranslations', () => {
|
|||
options: {},
|
||||
}),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"Translation file path at \\"my/translation/file.json\\" does not need to end with \\".json\\", we add the extension automatically."`,
|
||||
`"Translation file path at "my/translation/file.json" does not need to end with ".json", we add the extension automatically."`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -522,29 +523,27 @@ describe('readCodeTranslationFileContent', () => {
|
|||
await expect(() =>
|
||||
testReadTranslation('HEY'),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"value\\" must be of type object"`,
|
||||
`""value" must be of type object"`,
|
||||
);
|
||||
await expect(() =>
|
||||
testReadTranslation(42),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"value\\" must be of type object"`,
|
||||
`""value" must be of type object"`,
|
||||
);
|
||||
await expect(() =>
|
||||
testReadTranslation({key: {description: 'no message'}}),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"key.message\\" is required"`,
|
||||
);
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(`""key.message" is required"`);
|
||||
await expect(() =>
|
||||
testReadTranslation({key: {message: 42}}),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"key.message\\" must be a string"`,
|
||||
`""key.message" must be a string"`,
|
||||
);
|
||||
await expect(() =>
|
||||
testReadTranslation({
|
||||
key: {message: 'Message', description: 42},
|
||||
}),
|
||||
).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"\\"key.description\\" must be a string"`,
|
||||
`""key.description" must be a string"`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -335,7 +335,7 @@ describe('getHttpsConfig', () => {
|
|||
);
|
||||
process.env.SSL_KEY_FILE = path.join(__dirname, '__fixtures__/host.key');
|
||||
await expect(getHttpsConfig()).rejects.toThrowErrorMatchingInlineSnapshot(
|
||||
`"You specified SSL_CRT_FILE in your env, but the file \\"<PROJECT_ROOT>/packages/docusaurus/src/webpack/__tests__/__fixtures__/nonexistent.crt\\" can't be found."`,
|
||||
`"You specified SSL_CRT_FILE in your env, but the file "<PROJECT_ROOT>/packages/docusaurus/src/webpack/__tests__/__fixtures__/nonexistent.crt" can't be found."`,
|
||||
);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue