chore: spell-check test files (#6903)

This commit is contained in:
Joshua Chen 2022-03-12 15:24:56 +08:00 committed by GitHub
parent f6baaa6b75
commit 76cb012209
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
59 changed files with 184 additions and 155 deletions

View file

@ -21,12 +21,11 @@
], ],
"ignorePaths": [ "ignorePaths": [
"CHANGELOG.md", "CHANGELOG.md",
"examples",
"packages/docusaurus-theme-translations/locales", "packages/docusaurus-theme-translations/locales",
"__tests__",
"package.json", "package.json",
"yarn.lock", "yarn.lock",
"project-words.txt", "project-words.txt",
"__snapshots__",
"website/src/data/users.tsx", "website/src/data/users.tsx",
"website/src/data/tweets.tsx", "website/src/data/tweets.tsx",
"*.xyz", "*.xyz",

View file

@ -47,7 +47,7 @@ describe('packages', () => {
/* /*
If a package starts with @, if won't be published to public npm registry If a package starts with @, if won't be published to public npm registry
without an additional publishConfig.acces: "public" config without an additional publishConfig.access: "public" config
This will make you publish an incomplete list of Docusaurus packages This will make you publish an incomplete list of Docusaurus packages
when trying to release with lerna-publish when trying to release with lerna-publish
*/ */

View file

@ -10,6 +10,7 @@ import logger from '../index';
describe('formatters', () => { describe('formatters', () => {
it('path', () => { it('path', () => {
// cSpell:ignore mhey
expect(logger.path('hey')).toMatchInlineSnapshot(`"hey"`); expect(logger.path('hey')).toMatchInlineSnapshot(`"hey"`);
}); });
it('id', () => { it('id', () => {
@ -39,6 +40,7 @@ describe('interpolate', () => {
expect( 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`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( ).toMatchInlineSnapshot(
// cSpell:ignore mpackages
`"The package at packages/docusaurus has 10 files. Babel is exported here (as a preset) that you can with \`require.resolve('@docusaurus/core/lib/babel/preset')\`"`, `"The package at packages/docusaurus has 10 files. Babel is exported here (as a preset) that you can with \`require.resolve('@docusaurus/core/lib/babel/preset')\`"`,
); );
}); });

View file

@ -199,7 +199,9 @@ describe('headings remark plugin', () => {
const expected = u('root', [ const expected = u('root', [
heading('I ♥ unicode', 'i--unicode'), heading('I ♥ unicode', 'i--unicode'),
heading('Dash-dash', 'dash-dash'), heading('Dash-dash', 'dash-dash'),
// cSpell:ignore endash
heading('endash', 'endash'), heading('endash', 'endash'),
// cSpell:ignore emdash
heading('emdash', 'emdash'), heading('emdash', 'emdash'),
heading('😄 unicode emoji', '-unicode-emoji'), heading('😄 unicode emoji', '-unicode-emoji'),
heading('😄-😄 unicode emoji', '--unicode-emoji'), heading('😄-😄 unicode emoji', '--unicode-emoji'),
@ -214,6 +216,7 @@ describe('headings remark plugin', () => {
heading(':ok_hand: Single', 'ok_hand-single'), heading(':ok_hand: Single', 'ok_hand-single'),
heading( heading(
':ok_hand::hatched_chick: Two in a row with no spaces', ':ok_hand::hatched_chick: Two in a row with no spaces',
// cSpell:ignore handhatched
'ok_handhatched_chick-two-in-a-row-with-no-spaces', 'ok_handhatched_chick-two-in-a-row-with-no-spaces',
), ),
heading( heading(
@ -251,11 +254,11 @@ describe('headings remark plugin', () => {
## Heading Two {#custom-heading-two} ## Heading Two {#custom-heading-two}
# With *Bold* {#custom-withbold} # With *Bold* {#custom-with-bold}
# With *Bold* hello{#custom-withbold-hello} # With *Bold* hello{#custom-with-bold-hello}
# With *Bold* hello2 {#custom-withbold-hello2} # With *Bold* hello2 {#custom-with-bold-hello2}
# Snake-cased ID {#this_is_custom_id} # Snake-cased ID {#this_is_custom_id}
@ -281,15 +284,15 @@ describe('headings remark plugin', () => {
text: 'Heading Two', text: 'Heading Two',
}, },
{ {
id: 'custom-withbold', id: 'custom-with-bold',
text: 'With Bold', text: 'With Bold',
}, },
{ {
id: 'custom-withbold-hello', id: 'custom-with-bold-hello',
text: 'With Bold hello', text: 'With Bold hello',
}, },
{ {
id: 'custom-withbold-hello2', id: 'custom-with-bold-hello2',
text: 'With Bold hello2', text: 'With Bold hello2',
}, },
{ {

View file

@ -40,4 +40,4 @@
[json](./data.json) [json](./data.json)
[static json](/staticjson.json) [static json](/static-json.json)

View file

@ -52,6 +52,6 @@ exports[`transformAsset plugin transform md links to <a /> 1`] = `
<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/staticjson.raw!=!<PROJECT_ROOT>/node_modules/file-loader/dist/cjs.js?name=assets/files/[name]-[contenthash].[ext]!./static/staticjson.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>
" "
`; `;

View file

@ -13,6 +13,7 @@ describe('shouldQuotifyFrontMatter', () => {
expect( expect(
shouldQuotifyFrontMatter([ shouldQuotifyFrontMatter([
'title', 'title',
// cSpell:ignore sàáâãäåçèéêëìíîïðòóôõöùúûüýÿ
"Some title front matter with allowed special chars like sàáâãäåçèéêëìíîïðòóôõöùúûüýÿ!;,=+-_?'`&#()[]§%€$", "Some title front matter with allowed special chars like sàáâãäåçèéêëìíîïðòóôõöùúûüýÿ!;,=+-_?'`&#()[]§%€$",
]), ]),
).toBe(false); ).toBe(false);

View file

@ -8,4 +8,4 @@ exports[`validateRedirect throw for bad redirects 3`] = `"{\\"from\\":\\"/fromSo
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\\":[\\"heyho\\"],\\"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"`;

View file

@ -226,7 +226,7 @@ describe('collectRedirects', () => {
`${removeTrailingSlash(routePath)}/some/other/path/suffix2`, `${removeTrailingSlash(routePath)}/some/other/path/suffix2`,
], ],
}, },
['/', '/testpath', '/otherPath.html'], ['/', '/testPath', '/otherPath.html'],
), ),
undefined, undefined,
), ),
@ -241,12 +241,12 @@ describe('collectRedirects', () => {
}, },
{ {
from: '/testpath/some/path/suffix1', from: '/testPath/some/path/suffix1',
to: '/testpath', to: '/testPath',
}, },
{ {
from: '/testpath/some/other/path/suffix2', from: '/testPath/some/other/path/suffix2',
to: '/testpath', to: '/testPath',
}, },
{ {
@ -272,7 +272,7 @@ describe('collectRedirects', () => {
return undefined; return undefined;
}, },
}, },
['/', '/testpath', '/otherPath.html'], ['/', '/testPath', '/otherPath.html'],
), ),
undefined, undefined,
), ),

View file

@ -60,7 +60,7 @@ describe('validateRedirect', () => {
expect(() => expect(() =>
validateRedirect({ validateRedirect({
from: ['heyho'] as unknown as string, from: ['hey'] as unknown as string,
to: '/toSomePath?queryString=xyz', to: '/toSomePath?queryString=xyz',
}), }),
).toThrowErrorMatchingSnapshot(); ).toThrowErrorMatchingSnapshot();

View file

@ -1,5 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`blog plugin options schema throws Error in case of invalid feedtype 1`] = `[ValidationError: "feedOptions.type" does not match any of the allowed types]`; exports[`blog plugin options schema throws Error in case of invalid feed type 1`] = `[ValidationError: "feedOptions.type" does not match any of the allowed types]`;
exports[`blog plugin options schema throws Error in case of invalid options 1`] = `[ValidationError: "postsPerPage" must be greater than or equal to 1]`; exports[`blog plugin options schema throws Error in case of invalid options 1`] = `[ValidationError: "postsPerPage" must be greater than or equal to 1]`;

View file

@ -15,7 +15,7 @@ function testField(params: {
fieldName: keyof BlogPostFrontMatter; fieldName: keyof BlogPostFrontMatter;
validFrontMatters: BlogPostFrontMatter[]; validFrontMatters: BlogPostFrontMatter[];
convertibleFrontMatter?: [ convertibleFrontMatter?: [
ConvertableFrontMatter: Record<string, unknown>, ConvertibleFrontMatter: Record<string, unknown>,
ConvertedFrontMatter: BlogPostFrontMatter, ConvertedFrontMatter: BlogPostFrontMatter,
][]; ][];
invalidFrontMatters?: [ invalidFrontMatters?: [

View file

@ -74,16 +74,16 @@ const transform = async (
describe('truncate', () => { describe('truncate', () => {
it('truncates texts', () => { it('truncates texts', () => {
expect( expect(
truncate('aaa\n<!-- truncate -->\nbbb\nccc', /<!-- truncate -->/), truncate('aaa\n<!-- truncate -->\nbbb\n ccc', /<!-- truncate -->/),
).toBe('aaa\n'); ).toBe('aaa\n');
expect(truncate('\n<!-- truncate -->\nbbb\nccc', /<!-- truncate -->/)).toBe( expect(
'\n', truncate('\n<!-- truncate -->\nbbb\n ccc', /<!-- truncate -->/),
); ).toBe('\n');
}); });
it('leaves texts without markers', () => { it('leaves texts without markers', () => {
expect(truncate('aaa\nbbb\nccc', /<!-- truncate -->/)).toBe( expect(truncate('aaa\nbbb\n ccc', /<!-- truncate -->/)).toBe(
'aaa\nbbb\nccc', 'aaa\nbbb\n ccc',
); );
expect(truncate('', /<!-- truncate -->/)).toBe(''); expect(truncate('', /<!-- truncate -->/)).toBe('');
}); });
@ -165,12 +165,12 @@ describe('parseBlogFileName', () => {
it('parses nested folder tree respecting date convention', () => { it('parses nested folder tree respecting date convention', () => {
expect( expect(
parseBlogFileName( parseBlogFileName(
'2021/05/12/announcing-docusaurus-two-beta/subfolder/subfile.md', '2021/05/12/announcing-docusaurus-two-beta/subfolder/file.md',
), ),
).toEqual({ ).toEqual({
date: new Date('2021-05-12Z'), date: new Date('2021-05-12Z'),
text: 'announcing-docusaurus-two-beta/subfolder/subfile', text: 'announcing-docusaurus-two-beta/subfolder/file',
slug: '/2021/05/12/announcing-docusaurus-two-beta/subfolder/subfile', slug: '/2021/05/12/announcing-docusaurus-two-beta/subfolder/file',
}); });
}); });

View file

@ -63,7 +63,7 @@ describe('blog plugin options schema', () => {
expect(error).toMatchSnapshot(); expect(error).toMatchSnapshot();
}); });
it('throws Error in case of invalid feedtype', () => { it('throws Error in case of invalid feed type', () => {
const {error} = PluginOptionSchema.validate({ const {error} = PluginOptionSchema.validate({
feedOptions: { feedOptions: {
type: 'none', type: 'none',

View file

@ -70,6 +70,6 @@ Term 2 ~ Definition 2a ~ Definition 2b
This is HTML abbreviation example. This is HTML abbreviation example.
It converts "HTML", but keep intact partial entries like "xxxHTMLyyy" and so on. It converts "HTML", but keep intact partial entries like "xxxHTMLxxx" and so on.
\*[HTML]: Hyper Text Markup Language \*[HTML]: Hyper Text Markup Language

View file

@ -1,7 +1,7 @@
{ {
"docs": { "docs": {
"Test": [ "Test": [
"goku" "nonExistent"
] ]
} }
} }

View file

@ -19,7 +19,7 @@ Object {
exports[`sidebar site with wrong sidebar content 1`] = ` exports[`sidebar site with wrong sidebar content 1`] = `
"Invalid sidebar file at \\"packages/docusaurus-plugin-content-docs/src/__tests__/__fixtures__/simple-site/wrong-sidebars.json\\". "Invalid sidebar file at \\"packages/docusaurus-plugin-content-docs/src/__tests__/__fixtures__/simple-site/wrong-sidebars.json\\".
These sidebar document ids do not exist: These sidebar document ids do not exist:
- goku - nonExistent
Available document ids are: Available document ids are:
- doc with space - doc with space

View file

@ -13,7 +13,7 @@ function testField(params: {
prefix: string; prefix: string;
validFrontMatters: DocFrontMatter[]; validFrontMatters: DocFrontMatter[];
convertibleFrontMatter?: [ convertibleFrontMatter?: [
ConvertableFrontMatter: Record<string, unknown>, ConvertibleFrontMatter: Record<string, unknown>,
ConvertedFrontMatter: DocFrontMatter, ConvertedFrontMatter: DocFrontMatter,
][]; ][];
invalidFrontMatters?: [ invalidFrontMatters?: [

View file

@ -502,14 +502,14 @@ describe('simple site', () => {
const docs = await readVersionDocs(versionsMetadata[0], options); const docs = await readVersionDocs(versionsMetadata[0], options);
docs.push( docs.push(
createFakeDocFile({ createFakeDocFile({
source: 'hehe', source: 'bad',
frontMatter: {pagination_prev: 'nonexistent'}, frontMatter: {pagination_prev: 'nonexistent'},
}), }),
); );
await expect( await expect(
defaultTestUtils.generateNavigation(docs), defaultTestUtils.generateNavigation(docs),
).rejects.toThrowErrorMatchingInlineSnapshot( ).rejects.toThrowErrorMatchingInlineSnapshot(
`"Error when loading hehe in .: the pagination_prev front matter points to a non-existent ID nonexistent."`, `"Error when loading bad in .: the pagination_prev front matter points to a non-existent ID nonexistent."`,
); );
}); });
}); });

View file

@ -201,15 +201,11 @@ describe('empty/no docs website', () => {
pluginContentDocs( pluginContentDocs(
context, context,
normalizePluginOptions(OptionsSchema, { normalizePluginOptions(OptionsSchema, {
path: `path/doesnt/exist`, path: `path/does/not/exist`,
}), }),
), ),
).rejects.toThrowError( ).rejects.toThrowErrorMatchingInlineSnapshot(
`The docs folder does not exist for version "current". A docs folder is expected to be found at ${ `"The docs folder does not exist for version \\"current\\". A docs folder is expected to be found at path/does/not/exist."`,
process.platform === 'win32'
? 'path\\doesnt\\exist'
: 'path/doesnt/exist'
}.`,
); );
}); });
}); });

View file

@ -167,11 +167,11 @@ describe('getSlug', () => {
expect( expect(
getSlug({ getSlug({
baseID: 'any', baseID: 'any',
source: '@site/docs/unslashedDir/doc.md', source: '@site/docs/nonSlashedDir/doc.md',
sourceDirName: 'unslashedDir', sourceDirName: 'nonSlashedDir',
frontMatterSlug: 'abc/def', frontMatterSlug: 'abc/def',
}), }),
).toBe('/unslashedDir/abc/def'); ).toBe('/nonSlashedDir/abc/def');
expect( expect(
getSlug({ getSlug({
baseID: 'any', baseID: 'any',
@ -207,7 +207,7 @@ describe('getSlug', () => {
expect( expect(
getSlug({ getSlug({
baseID: 'any', baseID: 'any',
source: '@site/docs/dir/subdirdoc.md', source: '@site/docs/dir/subdirDoc.md',
sourceDirName: '/dir/subdir', sourceDirName: '/dir/subdir',
frontMatterSlug: '../../../../../abc/../def', frontMatterSlug: '../../../../../abc/../def',
}), }),

View file

@ -290,7 +290,7 @@ describe('versioned site, pluginId=default', () => {
versionClassName: 'docs-version-1.0.0', versionClassName: 'docs-version-1.0.0',
}; };
const vwithSlugs: VersionMetadata = { const vWithSlugs: VersionMetadata = {
contentPath: path.join( contentPath: path.join(
versionedSiteDir, versionedSiteDir,
'versioned_docs/version-withSlugs', 'versioned_docs/version-withSlugs',
@ -321,12 +321,12 @@ describe('versioned site, pluginId=default', () => {
vCurrent, vCurrent,
v101, v101,
v100, v100,
vwithSlugs, vWithSlugs,
}; };
} }
it('readVersionsMetadata versioned site', async () => { it('readVersionsMetadata versioned site', async () => {
const {defaultOptions, defaultContext, vCurrent, v101, v100, vwithSlugs} = const {defaultOptions, defaultContext, vCurrent, v101, v100, vWithSlugs} =
await loadSite(); await loadSite();
const versionsMetadata = await readVersionsMetadata({ const versionsMetadata = await readVersionsMetadata({
@ -334,11 +334,11 @@ describe('versioned site, pluginId=default', () => {
context: defaultContext, context: defaultContext,
}); });
expect(versionsMetadata).toEqual([vCurrent, v101, v100, vwithSlugs]); expect(versionsMetadata).toEqual([vCurrent, v101, v100, vWithSlugs]);
}); });
it('readVersionsMetadata versioned site with includeCurrentVersion=false', async () => { it('readVersionsMetadata versioned site with includeCurrentVersion=false', async () => {
const {defaultOptions, defaultContext, v101, v100, vwithSlugs} = const {defaultOptions, defaultContext, v101, v100, vWithSlugs} =
await loadSite(); await loadSite();
const versionsMetadata = await readVersionsMetadata({ const versionsMetadata = await readVersionsMetadata({
@ -350,12 +350,12 @@ describe('versioned site, pluginId=default', () => {
// vCurrent removed // vCurrent removed
v101, v101,
v100, v100,
vwithSlugs, vWithSlugs,
]); ]);
}); });
it('readVersionsMetadata versioned site with version options', async () => { it('readVersionsMetadata versioned site with version options', async () => {
const {defaultOptions, defaultContext, vCurrent, v101, v100, vwithSlugs} = const {defaultOptions, defaultContext, vCurrent, v101, v100, vWithSlugs} =
await loadSite(); await loadSite();
const versionsMetadata = await readVersionsMetadata({ const versionsMetadata = await readVersionsMetadata({
@ -404,12 +404,12 @@ describe('versioned site, pluginId=default', () => {
versionPath: '/docs', versionPath: '/docs',
versionBanner: 'unreleased', versionBanner: 'unreleased',
}, },
vwithSlugs, vWithSlugs,
]); ]);
}); });
it('readVersionsMetadata versioned site with editUrl', async () => { it('readVersionsMetadata versioned site with editUrl', async () => {
const {defaultOptions, defaultContext, vCurrent, v101, v100, vwithSlugs} = const {defaultOptions, defaultContext, vCurrent, v101, v100, vWithSlugs} =
await loadSite(); await loadSite();
const versionsMetadata = await readVersionsMetadata({ const versionsMetadata = await readVersionsMetadata({
@ -443,7 +443,7 @@ describe('versioned site, pluginId=default', () => {
'https://github.com/facebook/docusaurus/edit/main/website/i18n/en/docusaurus-plugin-content-docs/version-1.0.0', 'https://github.com/facebook/docusaurus/edit/main/website/i18n/en/docusaurus-plugin-content-docs/version-1.0.0',
}, },
{ {
...vwithSlugs, ...vWithSlugs,
versionEditUrl: versionEditUrl:
'https://github.com/facebook/docusaurus/edit/main/website/versioned_docs/version-withSlugs', 'https://github.com/facebook/docusaurus/edit/main/website/versioned_docs/version-withSlugs',
versionEditUrlLocalized: versionEditUrlLocalized:
@ -453,7 +453,7 @@ describe('versioned site, pluginId=default', () => {
}); });
it('readVersionsMetadata versioned site with editUrl and editCurrentVersion=true', async () => { it('readVersionsMetadata versioned site with editUrl and editCurrentVersion=true', async () => {
const {defaultOptions, defaultContext, vCurrent, v101, v100, vwithSlugs} = const {defaultOptions, defaultContext, vCurrent, v101, v100, vWithSlugs} =
await loadSite(); await loadSite();
const versionsMetadata = await readVersionsMetadata({ const versionsMetadata = await readVersionsMetadata({
@ -488,7 +488,7 @@ describe('versioned site, pluginId=default', () => {
'https://github.com/facebook/docusaurus/edit/main/website/i18n/en/docusaurus-plugin-content-docs/current', 'https://github.com/facebook/docusaurus/edit/main/website/i18n/en/docusaurus-plugin-content-docs/current',
}, },
{ {
...vwithSlugs, ...vWithSlugs,
versionEditUrl: versionEditUrl:
'https://github.com/facebook/docusaurus/edit/main/website/docs', 'https://github.com/facebook/docusaurus/edit/main/website/docs',
versionEditUrlLocalized: versionEditUrlLocalized:
@ -498,18 +498,18 @@ describe('versioned site, pluginId=default', () => {
}); });
it('readVersionsMetadata versioned site with onlyIncludeVersions option', async () => { it('readVersionsMetadata versioned site with onlyIncludeVersions option', async () => {
const {defaultOptions, defaultContext, v101, vwithSlugs} = await loadSite(); const {defaultOptions, defaultContext, v101, vWithSlugs} = await loadSite();
const versionsMetadata = await readVersionsMetadata({ const versionsMetadata = await readVersionsMetadata({
options: { options: {
...defaultOptions, ...defaultOptions,
// Order reversed on purpose: should not have any impact // Order reversed on purpose: should not have any impact
onlyIncludeVersions: [vwithSlugs.versionName, v101.versionName], onlyIncludeVersions: [vWithSlugs.versionName, v101.versionName],
}, },
context: defaultContext, context: defaultContext,
}); });
expect(versionsMetadata).toEqual([v101, vwithSlugs]); expect(versionsMetadata).toEqual([v101, vWithSlugs]);
}); });
it('readVersionsMetadata versioned site with disableVersioning', async () => { it('readVersionsMetadata versioned site with disableVersioning', async () => {

View file

@ -49,9 +49,9 @@ Array [
], ],
"label": "SubGuides (metadata file label)", "label": "SubGuides (metadata file label)",
"link": Object { "link": Object {
"description": "subguides-description", "description": "subGuides-description",
"slug": "subguides-generated-index-slug", "slug": "subGuides-generated-index-slug",
"title": "subguides-title", "title": "subGuides-title",
"type": "generated-index", "type": "generated-index",
}, },
"type": "category", "type": "category",

View file

@ -131,9 +131,9 @@ describe('DefaultSidebarItemsGenerator', () => {
label: 'SubGuides (metadata file label)', label: 'SubGuides (metadata file label)',
link: { link: {
type: 'generated-index', type: 'generated-index',
slug: 'subguides-generated-index-slug', slug: 'subGuides-generated-index-slug',
title: 'subguides-title', title: 'subGuides-title',
description: 'subguides-description', description: 'subGuides-description',
}, },
}, },
}, },

View file

@ -43,7 +43,7 @@ describe('loadSidebars', () => {
expect(result).toMatchSnapshot(); expect(result).toMatchSnapshot();
}); });
it('sidebars shorthand and longform lead to exact same sidebar', async () => { it('sidebars shorthand and longhand lead to exact same sidebar', async () => {
const sidebarPath1 = path.join(fixtureDir, 'sidebars-category.js'); const sidebarPath1 = path.join(fixtureDir, 'sidebars-category.js');
const sidebarPath2 = path.join( const sidebarPath2 = path.join(
fixtureDir, fixtureDir,
@ -81,8 +81,8 @@ describe('loadSidebars', () => {
expect(result).toMatchSnapshot(); expect(result).toMatchSnapshot();
}); });
it('unexisting path', async () => { it('nonexistent path', async () => {
await expect(loadSidebars('badpath', params)).resolves.toEqual( await expect(loadSidebars('bad/path', params)).resolves.toEqual(
DisabledSidebars, DisabledSidebars,
); );
}); });

View file

@ -83,6 +83,7 @@ describe('normalization', () => {
sidebar: 'item', sidebar: 'item',
}), }),
).toThrowErrorMatchingInlineSnapshot( ).toThrowErrorMatchingInlineSnapshot(
// cSpell:ignore msidebar
`"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."`, `"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."`,
); );
}); });

View file

@ -38,7 +38,7 @@ describe('createSitemap', () => {
{ {
url: 'https://example.com', url: 'https://example.com',
} as DocusaurusConfig, } as DocusaurusConfig,
['/', '/404.html', '/mypage'], ['/', '/404.html', '/my-page'],
{ {
changefreq: EnumChangefreq.DAILY, changefreq: EnumChangefreq.DAILY,
priority: 0.7, priority: 0.7,

View file

@ -24,7 +24,7 @@ import TabItem from '@theme/TabItem';
" "
`; `;
exports[`npm2yarn plugin tdoes not re-import tabs components when already imported below 1`] = ` exports[`npm2yarn plugin does not re-import tabs components when already imported below 1`] = `
"<Tabs> "<Tabs>
<TabItem value=\\"npm\\"> <TabItem value=\\"npm\\">

View file

@ -49,7 +49,7 @@ describe('npm2yarn plugin', () => {
expect(result).toMatchSnapshot(); expect(result).toMatchSnapshot();
}); });
it('tdoes not re-import tabs components when already imported below', async () => { it('does not re-import tabs components when already imported below', async () => {
const result = await processFixture('import-tabs-below'); const result = await processFixture('import-tabs-below');
expect(result).toMatchSnapshot(); expect(result).toMatchSnapshot();

View file

@ -38,7 +38,7 @@ describe('themeConfig', () => {
additionalLanguages: ['kotlin', 'java'], additionalLanguages: ['kotlin', 'java'],
}, },
announcementBar: { announcementBar: {
id: 'supportus', id: 'supports',
content: 'pls support', content: 'pls support',
backgroundColor: '#fff', backgroundColor: '#fff',
textColor: '#000', textColor: '#000',
@ -206,7 +206,7 @@ describe('themeConfig', () => {
{ {
type: 'joke', type: 'joke',
position: 'left', position: 'left',
label: 'haha', label: 'hahaha',
}, },
], ],
}, },

View file

@ -3,7 +3,7 @@
exports[`parseLines does not parse content with metastring 1`] = ` exports[`parseLines does not parse content with metastring 1`] = `
Object { Object {
"code": "aaaaa "code": "aaaaa
bbbbb", nnnnn",
"highlightLines": Array [ "highlightLines": Array [
0, 0,
], ],

View file

@ -68,7 +68,7 @@ describe('parseLanguage', () => {
describe('parseLines', () => { describe('parseLines', () => {
it('does not parse content with metastring', () => { it('does not parse content with metastring', () => {
expect(parseLines('aaaaa\nbbbbb', '{1}', 'js')).toMatchSnapshot(); expect(parseLines('aaaaa\nnnnnn', '{1}', 'js')).toMatchSnapshot();
expect( expect(
parseLines( parseLines(
`// highlight-next-line `// highlight-next-line

View file

@ -270,7 +270,7 @@ describe('isActiveSidebarItem', () => {
label: 'Label', label: 'Label',
}; };
expect(isActiveSidebarItem(item, '/unexistingPath')).toBe(false); expect(isActiveSidebarItem(item, '/nonexistentPath')).toBe(false);
expect(isActiveSidebarItem(item, '/itemPath')).toBe(true); expect(isActiveSidebarItem(item, '/itemPath')).toBe(true);
@ -286,7 +286,7 @@ describe('isActiveSidebarItem', () => {
href: '/itemPath', href: '/itemPath',
}); });
expect(isActiveSidebarItem(item, '/unexistingPath')).toBe(false); expect(isActiveSidebarItem(item, '/nonexistentPath')).toBe(false);
expect(isActiveSidebarItem(item, '/itemPath')).toBe(true); expect(isActiveSidebarItem(item, '/itemPath')).toBe(true);
@ -319,7 +319,7 @@ describe('isActiveSidebarItem', () => {
], ],
}); });
expect(isActiveSidebarItem(item, '/unexistingPath')).toBe(false); expect(isActiveSidebarItem(item, '/nonexistentPath')).toBe(false);
expect(isActiveSidebarItem(item, '/category-path')).toBe(true); expect(isActiveSidebarItem(item, '/category-path')).toBe(true);
expect(isActiveSidebarItem(item, '/sub-link-path')).toBe(true); expect(isActiveSidebarItem(item, '/sub-link-path')).toBe(true);

View file

@ -13,9 +13,10 @@ describe('isRegexpStringMatch', () => {
expect(isRegexpStringMatch('bar', undefined)).toBe(false); expect(isRegexpStringMatch('bar', undefined)).toBe(false);
expect(isRegexpStringMatch('foo', 'bar')).toBe(false); expect(isRegexpStringMatch('foo', 'bar')).toBe(false);
expect(isRegexpStringMatch('foo', 'foo')).toBe(true); expect(isRegexpStringMatch('foo', 'foo')).toBe(true);
// cSpell:ignore fooooooooooo
expect(isRegexpStringMatch('fooooooooooo', 'foo')).toBe(false); expect(isRegexpStringMatch('fooooooooooo', 'foo')).toBe(false);
expect(isRegexpStringMatch('foo', 'fooooooo')).toBe(true); expect(isRegexpStringMatch('foo', 'fooooooooooo')).toBe(true);
expect(isRegexpStringMatch('f.*o', 'fggo')).toBe(true); expect(isRegexpStringMatch('f.*o', 'fooooooooooo')).toBe(true);
expect(isRegexpStringMatch('FOO', 'foo')).toBe(true); expect(isRegexpStringMatch('FOO', 'foo')).toBe(true);
}); });
}); });

View file

@ -24,7 +24,7 @@ describe('listTagsByLetters', () => {
permalink: '/tag2', permalink: '/tag2',
count: 11, count: 11,
}; };
const tagzxy: Tag = { const tagZxy: Tag = {
name: 'zxy', name: 'zxy',
permalink: '/zxy', permalink: '/zxy',
count: 987, count: 987,
@ -34,34 +34,34 @@ describe('listTagsByLetters', () => {
permalink: '/abc', permalink: '/abc',
count: 123, count: 123,
}; };
const tagdef: Tag = { const tagDef: Tag = {
name: 'def', name: 'def',
permalink: '/def', permalink: '/def',
count: 1, count: 1,
}; };
const tagaaa: Tag = { const tagAaa: Tag = {
name: 'aaa', name: 'aaa',
permalink: '/aaa', permalink: '/aaa',
count: 10, count: 10,
}; };
const expectedResult: Result = [ const expectedResult: Result = [
{letter: 'A', tags: [tagaaa, tagAbc]}, {letter: 'A', tags: [tagAaa, tagAbc]},
{letter: 'D', tags: [tagdef]}, {letter: 'D', tags: [tagDef]},
{letter: 'T', tags: [tag1, tag2]}, {letter: 'T', tags: [tag1, tag2]},
{letter: 'Z', tags: [tagzxy]}, {letter: 'Z', tags: [tagZxy]},
]; ];
// Input order shouldn't matter, output is always consistently sorted // Input order shouldn't matter, output is always consistently sorted
expect( expect(
listTagsByLetters([tag1, tag2, tagzxy, tagAbc, tagdef, tagaaa]), listTagsByLetters([tag1, tag2, tagZxy, tagAbc, tagDef, tagAaa]),
).toEqual(expectedResult); ).toEqual(expectedResult);
expect( expect(
listTagsByLetters([tagzxy, tagdef, tagaaa, tag2, tagAbc, tag1]), listTagsByLetters([tagZxy, tagDef, tagAaa, tag2, tagAbc, tag1]),
).toEqual(expectedResult); ).toEqual(expectedResult);
expect( expect(
listTagsByLetters( listTagsByLetters(
_.shuffle([tagzxy, tagdef, tagaaa, tag2, tagAbc, tag1]), _.shuffle([tagZxy, tagDef, tagAaa, tag2, tagAbc, tag1]),
), ),
).toEqual(expectedResult); ).toEqual(expectedResult);
}); });

View file

@ -31,7 +31,7 @@ describe('validateThemeConfig', () => {
}); });
}); });
it('unexist config', () => { it('nonexistent config', () => {
expect(testValidateThemeConfig({})).toEqual({ expect(testValidateThemeConfig({})).toEqual({
liveCodeBlock: { liveCodeBlock: {
...DEFAULT_CONFIG, ...DEFAULT_CONFIG,

View file

@ -67,7 +67,7 @@ describe('readDefaultCodeTranslationMessages', () => {
); );
}); });
it('for unexisting locale', async () => { it('for nonexistent locale', async () => {
await expect( await expect(
readDefaultCodeTranslationMessages({ readDefaultCodeTranslationMessages({
locale: 'es', locale: 'es',

View file

@ -172,7 +172,7 @@ describe('findFolderContainingFile', () => {
it('find appropriate folder', async () => { it('find appropriate folder', async () => {
await expect( await expect(
findFolderContainingFile( findFolderContainingFile(
['/abcdef', '/gehij', __dirname, '/klmn'], ['/foo', '/baz', __dirname, '/bar'],
'dataFileUtils.test.ts', 'dataFileUtils.test.ts',
), ),
).resolves.toEqual(__dirname); ).resolves.toEqual(__dirname);
@ -180,7 +180,7 @@ describe('findFolderContainingFile', () => {
it('return undefined if no folder contain such file', async () => { it('return undefined if no folder contain such file', async () => {
await expect( await expect(
findFolderContainingFile(['/abcdef', '/gehij', '/klmn'], 'index.test.ts'), findFolderContainingFile(['/foo', '/bar', '/baz'], 'index.test.ts'),
).resolves.toBeUndefined(); ).resolves.toBeUndefined();
}); });
}); });
@ -189,7 +189,7 @@ describe('getFolderContainingFile', () => {
it('get appropriate folder', async () => { it('get appropriate folder', async () => {
await expect( await expect(
getFolderContainingFile( getFolderContainingFile(
['/abcdef', '/gehij', __dirname, '/klmn'], ['/foo', '/baz', __dirname, '/bar'],
'dataFileUtils.test.ts', 'dataFileUtils.test.ts',
), ),
).resolves.toEqual(__dirname); ).resolves.toEqual(__dirname);
@ -198,14 +198,14 @@ describe('getFolderContainingFile', () => {
it('throw if no folder contain such file', async () => { it('throw if no folder contain such file', async () => {
await expect( await expect(
getFolderContainingFile( getFolderContainingFile(
['/abcdef', '/gehij', '/klmn'], ['/foo', '/bar', '/baz'],
'dataFileUtils.test.ts', 'dataFileUtils.test.ts',
), ),
).rejects.toThrowErrorMatchingInlineSnapshot(` ).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:
- /abcdef - /foo
- /gehij - /bar
- /klmn]" - /baz"
`); `);
}); });
}); });

View file

@ -83,7 +83,7 @@ describe('getPluginI18nPath', () => {
}).replace(__dirname, ''), }).replace(__dirname, ''),
).toMatchInlineSnapshot(`"/i18n/zh-Hans/plugin-content-docs/foo"`); ).toMatchInlineSnapshot(`"/i18n/zh-Hans/plugin-content-docs/foo"`);
}); });
it('gets correct path when no subpaths', () => { it('gets correct path when no sub-paths', () => {
expect( expect(
getPluginI18nPath({ getPluginI18nPath({
siteDir: __dirname, siteDir: __dirname,

View file

@ -34,7 +34,7 @@ describe('removePrefix', () => {
expect(removePrefix('abcdef', '')).toBe('abcdef'); expect(removePrefix('abcdef', '')).toBe('abcdef');
}); });
it('removes prefix', () => { it('removes prefix', () => {
expect(removePrefix('abcdef', 'ab')).toBe('cdef'); expect(removePrefix('prefix', 'pre')).toBe('fix');
}); });
}); });

View file

@ -116,7 +116,7 @@ describe('createExcerpt', () => {
export function ItemCol(props) { return <Item {...props} className={'col col--6 margin-bottom--lg'}/> }; export function ItemCol(props) { return <Item {...props} className={'col col--6 margin-bottom--lg'}/> };
Lorem **ipsum** dolor sit \`amet\`[^1], consectetur _adipiscing_ elit. [**Vestibulum**](https://wiktionary.org/wiki/vestibulum) ex urna[^bignote], ~~molestie~~ et sagittis ut, varius ac justo :wink:. Lorem **ipsum** dolor sit \`amet\`[^1], consectetur _adipiscing_ elit. [**Vestibulum**](https://wiktionary.org/wiki/vestibulum) ex urna[^note], ~~molestie~~ et sagittis ut, varius ac justo :wink:.
Nunc porttitor libero nec vulputate venenatis. Nam nec rhoncus mauris. Morbi tempus est et nibh maximus, tempus venenatis arcu lobortis. Nunc porttitor libero nec vulputate venenatis. Nam nec rhoncus mauris. Morbi tempus est et nibh maximus, tempus venenatis arcu lobortis.
`), `),

View file

@ -31,7 +31,7 @@ describe('isNameTooLong', () => {
true, true,
'foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-test-1-test-2-787': 'foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-foo-bar-test-1-test-2-787':
true, true,
// Every Hanzi is three bytes // Every Han zi is three bytes
: :
{apfs: false, xfs: true}, {apfs: false, xfs: true},
}; };

View file

@ -10,6 +10,7 @@ import {createSlugger} from '../slugger';
describe('createSlugger', () => { describe('createSlugger', () => {
it('can create unique slugs', () => { it('can create unique slugs', () => {
const slugger = createSlugger(); const slugger = createSlugger();
// cSpell:ignore somevalue
expect(slugger.slug('Some$/vaLue$!^')).toBe('somevalue'); expect(slugger.slug('Some$/vaLue$!^')).toBe('somevalue');
expect(slugger.slug('Some$/vaLue$!^')).toBe('somevalue-1'); expect(slugger.slug('Some$/vaLue$!^')).toBe('somevalue-1');
expect(slugger.slug('Some$/vaLue$!^')).toBe('somevalue-2'); expect(slugger.slug('Some$/vaLue$!^')).toBe('somevalue-2');

View file

@ -243,6 +243,7 @@ describe('resolvePathname', () => {
describe('encodePath', () => { describe('encodePath', () => {
it('works', () => { it('works', () => {
expect(encodePath('a/foo/')).toBe('a/foo/'); expect(encodePath('a/foo/')).toBe('a/foo/');
// cSpell:ignore cfoo
expect(encodePath('a/<foo>/')).toBe('a/%3Cfoo%3E/'); expect(encodePath('a/<foo>/')).toBe('a/%3Cfoo%3E/');
expect(encodePath('a/你好/')).toBe('a/%E4%BD%A0%E5%A5%BD/'); expect(encodePath('a/你好/')).toBe('a/%E4%BD%A0%E5%A5%BD/');
}); });

View file

@ -83,7 +83,7 @@ export async function getFolderContainingFile(
throw new Error( throw new Error(
`File "${relativeFilePath}" does not exist in any of these folders:\n- ${folderPaths.join( `File "${relativeFilePath}" does not exist in any of these folders:\n- ${folderPaths.join(
'\n- ', '\n- ',
)}]`, )}`,
); );
} }
return maybeFolderPath; return maybeFolderPath;

View file

@ -34,18 +34,18 @@ describe('useBaseUrl', () => {
expect(mockUseBaseUrl('/hello')).toBe('/hello'); expect(mockUseBaseUrl('/hello')).toBe('/hello');
expect(mockUseBaseUrl('hello/')).toBe('/hello/'); expect(mockUseBaseUrl('hello/')).toBe('/hello/');
expect(mockUseBaseUrl('/hello/')).toBe('/hello/'); expect(mockUseBaseUrl('/hello/')).toBe('/hello/');
expect(mockUseBaseUrl('hello/byebye')).toBe('/hello/byebye'); expect(mockUseBaseUrl('hello/foo')).toBe('/hello/foo');
expect(mockUseBaseUrl('/hello/byebye')).toBe('/hello/byebye'); expect(mockUseBaseUrl('/hello/foo')).toBe('/hello/foo');
expect(mockUseBaseUrl('hello/byebye/')).toBe('/hello/byebye/'); expect(mockUseBaseUrl('hello/foo/')).toBe('/hello/foo/');
expect(mockUseBaseUrl('/hello/byebye/')).toBe('/hello/byebye/'); expect(mockUseBaseUrl('/hello/foo/')).toBe('/hello/foo/');
expect(mockUseBaseUrl('https://github.com')).toBe('https://github.com'); expect(mockUseBaseUrl('https://github.com')).toBe('https://github.com');
expect(mockUseBaseUrl('//reactjs.org')).toBe('//reactjs.org'); expect(mockUseBaseUrl('//reactjs.org')).toBe('//reactjs.org');
expect(mockUseBaseUrl('//reactjs.org', forcePrepend)).toBe('//reactjs.org'); expect(mockUseBaseUrl('//reactjs.org', forcePrepend)).toBe('//reactjs.org');
expect(mockUseBaseUrl('https://site.com', forcePrepend)).toBe( expect(mockUseBaseUrl('https://site.com', forcePrepend)).toBe(
'https://site.com', 'https://site.com',
); );
expect(mockUseBaseUrl('/hello/byebye', {absolute: true})).toBe( expect(mockUseBaseUrl('/hello/foo', {absolute: true})).toBe(
'https://docusaurus.io/hello/byebye', 'https://docusaurus.io/hello/foo',
); );
expect(mockUseBaseUrl('#hello')).toBe('#hello'); expect(mockUseBaseUrl('#hello')).toBe('#hello');
}); });
@ -63,10 +63,10 @@ describe('useBaseUrl', () => {
expect(mockUseBaseUrl('/hello')).toBe('/docusaurus/hello'); expect(mockUseBaseUrl('/hello')).toBe('/docusaurus/hello');
expect(mockUseBaseUrl('hello/')).toBe('/docusaurus/hello/'); expect(mockUseBaseUrl('hello/')).toBe('/docusaurus/hello/');
expect(mockUseBaseUrl('/hello/')).toBe('/docusaurus/hello/'); expect(mockUseBaseUrl('/hello/')).toBe('/docusaurus/hello/');
expect(mockUseBaseUrl('hello/byebye')).toBe('/docusaurus/hello/byebye'); expect(mockUseBaseUrl('hello/foo')).toBe('/docusaurus/hello/foo');
expect(mockUseBaseUrl('/hello/byebye')).toBe('/docusaurus/hello/byebye'); expect(mockUseBaseUrl('/hello/foo')).toBe('/docusaurus/hello/foo');
expect(mockUseBaseUrl('hello/byebye/')).toBe('/docusaurus/hello/byebye/'); expect(mockUseBaseUrl('hello/foo/')).toBe('/docusaurus/hello/foo/');
expect(mockUseBaseUrl('/hello/byebye/')).toBe('/docusaurus/hello/byebye/'); expect(mockUseBaseUrl('/hello/foo/')).toBe('/docusaurus/hello/foo/');
expect(mockUseBaseUrl('https://github.com')).toBe('https://github.com'); expect(mockUseBaseUrl('https://github.com')).toBe('https://github.com');
expect(mockUseBaseUrl('//reactjs.org')).toBe('//reactjs.org'); expect(mockUseBaseUrl('//reactjs.org')).toBe('//reactjs.org');
expect(mockUseBaseUrl('//reactjs.org', forcePrepend)).toBe('//reactjs.org'); expect(mockUseBaseUrl('//reactjs.org', forcePrepend)).toBe('//reactjs.org');
@ -74,8 +74,8 @@ describe('useBaseUrl', () => {
expect(mockUseBaseUrl('https://site.com', forcePrepend)).toBe( expect(mockUseBaseUrl('https://site.com', forcePrepend)).toBe(
'https://site.com', 'https://site.com',
); );
expect(mockUseBaseUrl('/hello/byebye', {absolute: true})).toBe( expect(mockUseBaseUrl('/hello/foo', {absolute: true})).toBe(
'https://docusaurus.io/docusaurus/hello/byebye', 'https://docusaurus.io/docusaurus/hello/foo',
); );
expect(mockUseBaseUrl('/docusaurus/')).toBe('/docusaurus/'); expect(mockUseBaseUrl('/docusaurus/')).toBe('/docusaurus/');
expect(mockUseBaseUrl('/docusaurus/hello')).toBe('/docusaurus/hello'); expect(mockUseBaseUrl('/docusaurus/hello')).toBe('/docusaurus/hello');
@ -102,18 +102,18 @@ describe('useBaseUrlUtils().withBaseUrl()', () => {
expect(withBaseUrl('/hello')).toBe('/hello'); expect(withBaseUrl('/hello')).toBe('/hello');
expect(withBaseUrl('hello/')).toBe('/hello/'); expect(withBaseUrl('hello/')).toBe('/hello/');
expect(withBaseUrl('/hello/')).toBe('/hello/'); expect(withBaseUrl('/hello/')).toBe('/hello/');
expect(withBaseUrl('hello/byebye')).toBe('/hello/byebye'); expect(withBaseUrl('hello/foo')).toBe('/hello/foo');
expect(withBaseUrl('/hello/byebye')).toBe('/hello/byebye'); expect(withBaseUrl('/hello/foo')).toBe('/hello/foo');
expect(withBaseUrl('hello/byebye/')).toBe('/hello/byebye/'); expect(withBaseUrl('hello/foo/')).toBe('/hello/foo/');
expect(withBaseUrl('/hello/byebye/')).toBe('/hello/byebye/'); expect(withBaseUrl('/hello/foo/')).toBe('/hello/foo/');
expect(withBaseUrl('https://github.com')).toBe('https://github.com'); expect(withBaseUrl('https://github.com')).toBe('https://github.com');
expect(withBaseUrl('//reactjs.org')).toBe('//reactjs.org'); expect(withBaseUrl('//reactjs.org')).toBe('//reactjs.org');
expect(withBaseUrl('//reactjs.org', forcePrepend)).toBe('//reactjs.org'); expect(withBaseUrl('//reactjs.org', forcePrepend)).toBe('//reactjs.org');
expect(withBaseUrl('https://site.com', forcePrepend)).toBe( expect(withBaseUrl('https://site.com', forcePrepend)).toBe(
'https://site.com', 'https://site.com',
); );
expect(withBaseUrl('/hello/byebye', {absolute: true})).toBe( expect(withBaseUrl('/hello/foo', {absolute: true})).toBe(
'https://docusaurus.io/hello/byebye', 'https://docusaurus.io/hello/foo',
); );
expect(withBaseUrl('#hello')).toBe('#hello'); expect(withBaseUrl('#hello')).toBe('#hello');
}); });
@ -130,18 +130,18 @@ describe('useBaseUrlUtils().withBaseUrl()', () => {
expect(withBaseUrl('/hello')).toBe('/docusaurus/hello'); expect(withBaseUrl('/hello')).toBe('/docusaurus/hello');
expect(withBaseUrl('hello/')).toBe('/docusaurus/hello/'); expect(withBaseUrl('hello/')).toBe('/docusaurus/hello/');
expect(withBaseUrl('/hello/')).toBe('/docusaurus/hello/'); expect(withBaseUrl('/hello/')).toBe('/docusaurus/hello/');
expect(withBaseUrl('hello/byebye')).toBe('/docusaurus/hello/byebye'); expect(withBaseUrl('hello/foo')).toBe('/docusaurus/hello/foo');
expect(withBaseUrl('/hello/byebye')).toBe('/docusaurus/hello/byebye'); expect(withBaseUrl('/hello/foo')).toBe('/docusaurus/hello/foo');
expect(withBaseUrl('hello/byebye/')).toBe('/docusaurus/hello/byebye/'); expect(withBaseUrl('hello/foo/')).toBe('/docusaurus/hello/foo/');
expect(withBaseUrl('/hello/byebye/')).toBe('/docusaurus/hello/byebye/'); expect(withBaseUrl('/hello/foo/')).toBe('/docusaurus/hello/foo/');
expect(withBaseUrl('https://github.com')).toBe('https://github.com'); expect(withBaseUrl('https://github.com')).toBe('https://github.com');
expect(withBaseUrl('//reactjs.org')).toBe('//reactjs.org'); expect(withBaseUrl('//reactjs.org')).toBe('//reactjs.org');
expect(withBaseUrl('//reactjs.org', forcePrepend)).toBe('//reactjs.org'); expect(withBaseUrl('//reactjs.org', forcePrepend)).toBe('//reactjs.org');
expect(withBaseUrl('https://site.com', forcePrepend)).toBe( expect(withBaseUrl('https://site.com', forcePrepend)).toBe(
'https://site.com', 'https://site.com',
); );
expect(withBaseUrl('/hello/byebye', {absolute: true})).toBe( expect(withBaseUrl('/hello/foo', {absolute: true})).toBe(
'https://docusaurus.io/docusaurus/hello/byebye', 'https://docusaurus.io/docusaurus/hello/foo',
); );
expect(withBaseUrl('/docusaurus/')).toBe('/docusaurus/'); expect(withBaseUrl('/docusaurus/')).toBe('/docusaurus/');
expect(withBaseUrl('/docusaurus/hello')).toBe('/docusaurus/hello'); expect(withBaseUrl('/docusaurus/hello')).toBe('/docusaurus/hello');

View file

@ -30,6 +30,7 @@ describe('transformMarkdownContent', () => {
it('can slugify complex headings', () => { it('can slugify complex headings', () => {
const input = '## abc [Hello] How are you %Sébastien_-_$)( ## -56756'; const input = '## abc [Hello] How are you %Sébastien_-_$)( ## -56756';
expect(transformMarkdownContent(input)).toBe( expect(transformMarkdownContent(input)).toBe(
// cSpell:ignore ébastien
`${input} {#abc-hello-how-are-you-sébastien_-_---56756}`, `${input} {#abc-hello-how-are-you-sébastien_-_---56756}`,
); );
}); });

View file

@ -19,5 +19,5 @@ export const Components = {
}; };
export async function createTempSiteDir(): Promise<string> { export async function createTempSiteDir(): Promise<string> {
return fs.mkdtemp(path.join(os.tmpdir(), 'docusaurus-test-swizzle-sitedir')); return fs.mkdtemp(path.join(os.tmpdir(), 'docusaurus-test-swizzle-siteDir'));
} }

View file

@ -6,11 +6,11 @@
*/ */
module.exports = { module.exports = {
title: 'Sakura', title: 'Site',
tagline: 'This is not an ordinary site', tagline: 'This is not an ordinary site',
organizationName: 'endiliey', organizationName: 'endiliey',
projectName: 'sakura', projectName: 'site',
baseUrl: '/sakura/', baseUrl: '/site/',
url: 'https://docusaurus.io', url: 'https://docusaurus.io',
favicon: 'img/docusaurus.ico', favicon: 'img/docusaurus.ico',
plugins: [ plugins: [

View file

@ -61,6 +61,6 @@ Term 2 ~ Definition 2a ~ Definition 2b
This is HTML abbreviation example. This is HTML abbreviation example.
It converts "HTML", but keep intact partial entries like "xxxHTMLyyy" and so on. It converts "HTML", but keep intact partial entries like "fooHTMLoo" and so on.
\*[HTML]: Hyper Text Markup Language \*[HTML]: Hyper Text Markup Language

View file

@ -58,6 +58,7 @@ describe('handleBrokenLinks', () => {
// bad - non-existent file with spaces in name // bad - non-existent file with spaces in name
'./some%20other%20non-existent%20doc1', './some%20other%20non-existent%20doc1',
// evil - trying to use ../../ but '/' won't get decoded // evil - trying to use ../../ but '/' won't get decoded
// cSpell:ignore Fout
'./break%2F..%2F..%2Fout2', './break%2F..%2F..%2Fout2',
], ],
'/docs/goodDoc': [ '/docs/goodDoc': [

View file

@ -86,7 +86,7 @@ describe('normalizeConfig', () => {
it('throws error for baseUrl without trailing `/`', () => { it('throws error for baseUrl without trailing `/`', () => {
expect(() => { expect(() => {
normalizeConfig({ normalizeConfig({
baseUrl: 'noslash', baseUrl: 'noSlash',
}); });
}).toThrowErrorMatchingSnapshot(); }).toThrowErrorMatchingSnapshot();
}); });

View file

@ -28,51 +28,51 @@ function loadI18nTest(i18nConfig: I18nConfig, locale?: string) {
} }
describe('defaultLocaleConfig', () => { describe('defaultLocaleConfig', () => {
const canComputeLabel = typeof Intl.DisplayNames !== 'undefined';
it('returns correct labels', () => { it('returns correct labels', () => {
expect(getDefaultLocaleConfig('fr')).toEqual({ expect(getDefaultLocaleConfig('fr')).toEqual({
label: canComputeLabel ? 'Français' : 'fr', label: 'Français',
direction: 'ltr', direction: 'ltr',
htmlLang: 'fr', htmlLang: 'fr',
}); });
expect(getDefaultLocaleConfig('fr-FR')).toEqual({ expect(getDefaultLocaleConfig('fr-FR')).toEqual({
label: canComputeLabel ? 'Français (France)' : 'fr-FR', label: 'Français (France)',
direction: 'ltr', direction: 'ltr',
htmlLang: 'fr-FR', htmlLang: 'fr-FR',
}); });
expect(getDefaultLocaleConfig('en')).toEqual({ expect(getDefaultLocaleConfig('en')).toEqual({
label: canComputeLabel ? 'English' : 'en', label: 'English',
direction: 'ltr', direction: 'ltr',
htmlLang: 'en', htmlLang: 'en',
}); });
expect(getDefaultLocaleConfig('en-US')).toEqual({ expect(getDefaultLocaleConfig('en-US')).toEqual({
label: canComputeLabel ? 'American English' : 'en-US', label: 'American English',
direction: 'ltr', direction: 'ltr',
htmlLang: 'en-US', htmlLang: 'en-US',
}); });
expect(getDefaultLocaleConfig('zh')).toEqual({ expect(getDefaultLocaleConfig('zh')).toEqual({
label: canComputeLabel ? '中文' : 'zh', label: '中文',
direction: 'ltr', direction: 'ltr',
htmlLang: 'zh', htmlLang: 'zh',
}); });
expect(getDefaultLocaleConfig('zh-CN')).toEqual({ expect(getDefaultLocaleConfig('zh-CN')).toEqual({
label: canComputeLabel ? '中文(中国)' : 'zh-CN', label: '中文(中国)',
direction: 'ltr', direction: 'ltr',
htmlLang: 'zh-CN', htmlLang: 'zh-CN',
}); });
expect(getDefaultLocaleConfig('en-US')).toEqual({ expect(getDefaultLocaleConfig('en-US')).toEqual({
label: canComputeLabel ? 'American English' : 'en-US', label: 'American English',
direction: 'ltr', direction: 'ltr',
htmlLang: 'en-US', htmlLang: 'en-US',
}); });
expect(getDefaultLocaleConfig('fa')).toEqual({ expect(getDefaultLocaleConfig('fa')).toEqual({
label: canComputeLabel ? 'فارسی' : 'fa', // cSpell:ignore فارسی
label: 'فارسی',
direction: 'rtl', direction: 'rtl',
htmlLang: 'fa', htmlLang: 'fa',
}); });
expect(getDefaultLocaleConfig('fa-IR')).toEqual({ expect(getDefaultLocaleConfig('fa-IR')).toEqual({
label: canComputeLabel ? 'فارسی (ایران)' : 'fa-IR', // cSpell:ignore ایران فارسیا
label: 'فارسی (ایران)',
direction: 'rtl', direction: 'rtl',
htmlLang: 'fa-IR', htmlLang: 'fa-IR',
}); });
@ -127,7 +127,7 @@ describe('loadI18n', () => {
}); });
}); });
it('loads I18n for multi-locale config with some xcustom locale configs', async () => { it('loads I18n for multi-locale config with some custom locale configs', async () => {
await expect( await expect(
loadI18nTest( loadI18nTest(
{ {

View file

@ -108,9 +108,9 @@ describe('htmlTagObjectToString', () => {
it('invalid html tag object', () => { it('invalid html tag object', () => {
expect(() => expect(() =>
htmlTagObjectToString('fooofofoofo'), htmlTagObjectToString('foo'),
).toThrowErrorMatchingInlineSnapshot( ).toThrowErrorMatchingInlineSnapshot(
`"\\"fooofofoofo\\" is not a valid HTML tag object."`, `"\\"foo\\" is not a valid HTML tag object."`,
); );
expect(() => expect(() =>

View file

@ -621,7 +621,7 @@ export default function MyComponent() {
); );
// This one should not be found! On purpose! // This one should not be found! On purpose!
const plugin1File3 = path.join(plugin1Dir, 'unscannedFolder', 'file3.jsx'); const plugin1File3 = path.join(plugin1Dir, 'ignoredFolder', 'file3.jsx');
await fs.outputFile( await fs.outputFile(
plugin1File3, plugin1File3,
` `

View file

@ -60,7 +60,7 @@ describe('babel transpilation exclude logic', () => {
'/website/node_modules/react-trend/index.js', '/website/node_modules/react-trend/index.js',
'/docusaurus/website/node_modules/react-super.js', '/docusaurus/website/node_modules/react-super.js',
'/docusaurus/website/node_modules/@docusaurus/core/node_modules/core-js/modules/_descriptors.js', '/docusaurus/website/node_modules/@docusaurus/core/node_modules/core-js/modules/_descriptors.js',
'node_modules/docusaurus-theme-classic/node_modules/react-daypicker/index.js', 'node_modules/docusaurus-theme-classic/node_modules/react-slick/index.js',
]; ];
moduleFiles.forEach((file) => { moduleFiles.forEach((file) => {
expect(excludeJS(file)).toBe(true); expect(excludeJS(file)).toBe(true);

View file

@ -5,6 +5,7 @@ alexey
algoliasearch algoliasearch
anonymized anonymized
anshul anshul
août
apfs apfs
apos apos
appinstalled appinstalled
@ -12,6 +13,7 @@ applanga
architecting architecting
astro astro
atrule atrule
autoconverted
autogen autogen
autogenerating autogenerating
backport backport
@ -39,8 +41,8 @@ cheng
clément clément
clsx clsx
codeql codeql
codespaces
codesandbox codesandbox
codespaces
contravariance contravariance
corejs corejs
crawlable crawlable
@ -50,10 +52,12 @@ customizability
daishi daishi
datagit datagit
datas datas
décembre
dedup dedup
deduplicated deduplicated
déja déja
deps deps
devspace
devto devto
dmitry dmitry
docgen docgen
@ -65,6 +69,7 @@ docz
doesn doesn
dogfood dogfood
dogfooding dogfooding
dojocat
dyte dyte
easyops easyops
endi endi
@ -78,6 +83,7 @@ evaluable
externalwaiting externalwaiting
failfast failfast
fbid fbid
février
fienny fienny
flac flac
formik formik
@ -91,7 +97,9 @@ globby
goss goss
goyal goyal
gtag gtag
hahaha
héctor héctor
héllô
heuristical heuristical
hideable hideable
hola hola
@ -107,8 +115,10 @@ intelli
interpolatable interpolatable
jakepartusch jakepartusch
jamstack jamstack
janvier
javadoc javadoc
jmarcey jmarcey
joshcena
jscodeshift jscodeshift
jssdk jssdk
kaszubowski kaszubowski
@ -184,6 +194,7 @@ peaceiris
philpl philpl
photoshop photoshop
picocolors picocolors
picomatch
pluggable pluggable
plushie plushie
pnpm pnpm
@ -214,6 +225,7 @@ quddus
quddús quddús
quotify quotify
ramón ramón
reactjs
rearchitecture rearchitecture
recrawl recrawl
redirections redirections
@ -241,30 +253,38 @@ setaf
sida sida
simen simen
slorber slorber
spâce
stackblitz stackblitz
stackblitzrc stackblitzrc
strikethrough
strikethroughs strikethroughs
stylelint stylelint
stylelintrc stylelintrc
subdir
sublabel sublabel
sublicensable sublicensable
sublist sublist
subsubsection
subpage subpage
subroute subroute
subroutes subroutes
subsetting subsetting
subsubcategory
subsubfolder
subsubsection
subsubsubfolder
sucipto sucipto
supabase supabase
svgr svgr
swizzlable swizzlable
teik teik
templating templating
thanos
toolset toolset
toplevel toplevel
transifex transifex
transpiles transpiles
treeified treeified
treeifies
treeify treeify
treosh treosh
triaging triaging
@ -280,6 +300,7 @@ unprefixed
unswizzle unswizzle
unversioned unversioned
upvotes upvotes
urlset
userland userland
vannicatte vannicatte
vercel vercel

View file

@ -70,6 +70,7 @@ describe('users data', () => {
}), }),
}).unknown(false), }).unknown(false),
); );
// cSpell:ignore opensource
if (user.tags.includes('opensource') && user.source === null) { if (user.tags.includes('opensource') && user.source === null) {
throw new Error( throw new Error(
"You can't add the 'opensource' tag to a site that does not have a link to source code. Please add your source code, or remove this tag.", "You can't add the 'opensource' tag to a site that does not have a link to source code. Please add your source code, or remove this tag.",