mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-02 19:03:38 +02:00
refactor: ensure all types are using index signature instead of Record (#6995)
* refactor: ensure all types are using index signature instead of Record * kick CI
This commit is contained in:
parent
e8800b9d49
commit
87592bca03
99 changed files with 339 additions and 307 deletions
11
packages/docusaurus-remark-plugin-npm2yarn/src/__tests__/__fixtures__/sync.md
generated
Normal file
11
packages/docusaurus-remark-plugin-npm2yarn/src/__tests__/__fixtures__/sync.md
generated
Normal file
|
@ -0,0 +1,11 @@
|
|||
```bash npm2yarn
|
||||
npm install --global docusaurus
|
||||
```
|
||||
|
||||
```bash npm2yarn
|
||||
npm install --save docusaurus-plugin-name
|
||||
```
|
||||
|
||||
```bash npm2yarn
|
||||
npm run build
|
||||
```
|
|
@ -48,6 +48,21 @@ import TabItem from '@theme/TabItem';
|
|||
"
|
||||
`;
|
||||
|
||||
exports[`npm2yarn plugin does not work when language is not set 1`] = `
|
||||
"\`\`\`npm2yarn
|
||||
npm install --save docusaurus-plugin-name
|
||||
\`\`\`
|
||||
|
||||
\`\`\`bash
|
||||
npm install --save docusaurus-plugin-name
|
||||
\`\`\`
|
||||
|
||||
\`\`\`shell
|
||||
npm install --save docusaurus-plugin-name
|
||||
\`\`\`
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`npm2yarn plugin works on installation file 1`] = `
|
||||
"import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
@ -98,17 +113,29 @@ yarn add docusaurus-plugin-name
|
|||
"
|
||||
`;
|
||||
|
||||
exports[`npm2yarn plugin works when language is not set 1`] = `
|
||||
"\`\`\`npm2yarn
|
||||
npm install --save docusaurus-plugin-name
|
||||
\`\`\`
|
||||
exports[`npm2yarn plugin works with sync option 1`] = `
|
||||
"import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
## Installing a plugin
|
||||
|
||||
A plugin is usually a npm package, so you install them like other npm packages using npm.
|
||||
|
||||
<Tabs groupId=\\"npm2yarn\\">
|
||||
<TabItem value=\\"npm\\">
|
||||
|
||||
\`\`\`bash
|
||||
npm install --save docusaurus-plugin-name
|
||||
\`\`\`
|
||||
|
||||
\`\`\`shell
|
||||
npm install --save docusaurus-plugin-name
|
||||
</TabItem>
|
||||
<TabItem value=\\"yarn\\" label=\\"Yarn\\">
|
||||
|
||||
\`\`\`bash
|
||||
yarn add docusaurus-plugin-name
|
||||
\`\`\`
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
"
|
||||
`;
|
||||
|
|
|
@ -16,10 +16,7 @@ import mdx from 'remark-mdx';
|
|||
const processFixture = async (name: string, options?: {sync?: boolean}) => {
|
||||
const filePath = path.join(__dirname, '__fixtures__', `${name}.md`);
|
||||
const file = await vfile.read(filePath);
|
||||
const result = await remark()
|
||||
.use(mdx)
|
||||
.use(npm2yarn, {...options, filePath})
|
||||
.process(file);
|
||||
const result = await remark().use(mdx).use(npm2yarn, options).process(file);
|
||||
|
||||
return result.toString();
|
||||
};
|
||||
|
@ -37,7 +34,13 @@ describe('npm2yarn plugin', () => {
|
|||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('works when language is not set', async () => {
|
||||
it('works with sync option', async () => {
|
||||
const result = await processFixture('plugin', {sync: true});
|
||||
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('does not work when language is not set', async () => {
|
||||
const result = await processFixture('syntax-not-properly-set');
|
||||
|
||||
expect(result).toMatchSnapshot();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue