docusaurus/admin/test-bad-package
Sébastien Lorber fd43036ab8
Some checks failed
Argos CI / take-screenshots (push) Has been cancelled
Build Hash Router / Build Hash Router (push) Has been cancelled
Canary Release / Publish Canary (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Continuous Releases / Continuous Releases (push) Has been cancelled
E2E Tests / E2E — Yarn v1 (18.0) (push) Has been cancelled
E2E Tests / E2E — Yarn v1 (20) (push) Has been cancelled
E2E Tests / E2E — Yarn v1 (22) (push) Has been cancelled
E2E Tests / E2E — Yarn Berry (node-modules, -s) (push) Has been cancelled
E2E Tests / E2E — Yarn Berry (node-modules, -st) (push) Has been cancelled
E2E Tests / E2E — Yarn Berry (pnp, -s) (push) Has been cancelled
E2E Tests / E2E — Yarn Berry (pnp, -st) (push) Has been cancelled
E2E Tests / E2E — npm (push) Has been cancelled
E2E Tests / E2E — pnpm (push) Has been cancelled
chore: release Docusaurus 3.6.3 (#10713)
2024-11-22 17:13:56 +01:00
..
package.json chore: release Docusaurus 3.6.3 (#10713) 2024-11-22 17:13:56 +01:00
README.mdx

# test-bad-package

This package declares a wrong React version on purpose (16.14.0)

The goal is to test that the MD/MDX content of this package can still be imported/rendered by our website.

See related issue https://github.com/facebook/docusaurus/issues/9027

---

import {version as ReactVersion} from 'react';
import {version as ReactDOMVersion} from 'react-dom';

export function TestComponent() {
  const expectedVersion = 18;
  if (!ReactVersion.startsWith(`${expectedVersion}`)) {
    throw new Error(
      `'test-bad-package/README.mdx' is rendered with bad React version: ${ReactVersion}`,
    );
  }
  if (!ReactVersion.startsWith(`${expectedVersion}`)) {
    throw new Error(
      `'test-bad-package/README.mdx' is rendered with bad React-DOM version: ${ReactDOMVersion}`,
    );
  }
  return (
    <>
      <div>React version: {ReactVersion}</div>
      <div>React DOM version: {ReactDOMVersion}</div>
    </>
  );
}

<TestComponent />

---

## MDX Components work:

<details>
  <summary>Summary</summary>

Details

</details>

```js
const age = 42;
```