Skip to content

Commit

Permalink
docs: remove --platform, --node, --bun and deno
Browse files Browse the repository at this point in the history
  • Loading branch information
wellwelwel committed Dec 11, 2024
1 parent e2f059f commit 4bfdfff
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 424 deletions.
1 change: 0 additions & 1 deletion website/docs/documentation/poku/config-files.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ module.exports = defineConfig({
],
pid: [612],
},
platform: 'node', // "node", "bun" and "deno"
deno: {
allow: ['run', 'env', 'read', 'net'],
deny: [], // Same as allow
Expand Down
86 changes: 0 additions & 86 deletions website/docs/documentation/poku/options/platform.mdx

This file was deleted.

2 changes: 1 addition & 1 deletion website/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ npx poku
<TabItem value='Bun'>

```bash
bunx poku
bun poku
```

</TabItem>
Expand Down
4 changes: 2 additions & 2 deletions website/docs/philosophy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ npx poku test.js
<TabItem default value='Bun + Poku'>

```bash
bunx poku test.js
bun poku test.js
```

</TabItem>
Expand Down Expand Up @@ -200,7 +200,7 @@ npx poku
<TabItem value='Bun'>

```bash
bunx poku
bun poku
```

</TabItem>
Expand Down
127 changes: 6 additions & 121 deletions website/docs/tutorials/cross-platform.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,61 +26,20 @@ import Maintainer from '@site/static/img/maintainer.svg';

## Running tests in specific platforms

First, let's understand what each definition does:

```sh
npx poku
```

- It tries to identify the platform or run it in **Node.js** by default.

```sh
npx poku --node
```

- It calls **Poku** through **Node.js** and runs all the tests using **Node.js**.

```sh
npx poku --bun
```

- It calls **Poku** through **Node.js**, but runs all the tests using **Bun**.

```sh
npx poku --deno
```

- It calls **Poku** through **Node.js**, but runs all the tests using **Deno**.

:::note
It's important to note that the **Poku** runtime is different from the test runtime (`node`, `npx tsx`, `bun`, or `deno`).
:::

<hr />

- See the `platform` section [here](/docs/documentation/poku/options/platform).
- See all available flags and options for `poku` command [here](/docs/category/-poku).

<hr />

### Recommendations

To avoid conflicts in environments with multiple platforms installed (**Node.js** + **Bun**, **Deno** + **Bun**. etc.), see the following examples:

```sh
npx poku --node
```

- It runs **Poku** through **Node.js** and ensures that all tests are run with **Node.js** (or **tsx** for **TypeScript** tests).

```sh
bunx poku --bun
bun poku
```

- It runs **Poku** through **Bun** and ensures that all tests are run with **Bun**.

```sh
deno run npm:poku --deno
deno run npm:poku
```

- It runs **Poku** through **Deno** and ensures that all tests are run with **Deno**.
Expand All @@ -91,104 +50,30 @@ For **TypeScript** users, there's no need to install **tsx** for **Bun** and **D

<hr />

### Running CommonJS with Deno
### Running CommonJS with Deno `v1`

> See all options for **Deno** [here](/docs/documentation/poku/options/deno).
#### All files as CommonJS

```sh
deno run npm:poku --deno --denoCjs
deno run npm:poku --denoCjs
```

#### A specific extension as CommonJS

```sh
deno run npm:poku --deno --denoCjs='.cjs'
deno run npm:poku --denoCjs='.cjs'
```

#### Multiple extensions as CommonJS

```sh
deno run npm:poku --deno --denoCjs='.cjs,.js'
deno run npm:poku --denoCjs='.cjs,.js'
```

<hr />

## Using Poku API _(advanced concept)_

In **Poku**'s description, you can read _"Poku makes testing easy for Node.js, Bun, Deno, and you <u>at the same time</u>"_, and it's true:

> This is more to demonstrate a point, not a recommendation 🙋🏻‍♂️
_./test/run.test.ts_:

```ts
import { describe, it, poku, exit } from 'poku';

const noExit = true;

const codes: (0 | 1)[] = [];

await describe('Running Tests on Different Platforms at the Same Time', async () => {
await Promise.all([
it('Test suite should pass on Node.js', async () => {
const exitCode = await poku(['./test/unit'], {
platform: 'node',
noExit,
});

codes.push(exitCode);
}),

it('Test suite should pass on Bun', async () => {
const exitCode = await poku(['./test/unit'], {
platform: 'bun',
noExit,
});

codes.push(exitCode);
}),

it('Test suite should pass on Deno', async () => {
const exitCode = await poku(['./test/unit'], {
platform: 'deno',
noExit,
deno: {
cjs: ['.cjs'],
},
});

codes.push(exitCode);
}),
]);
});

const code = codes.every((code) => code === 0) ? 0 : 1;

exit(code);
```

Then, choose a platform:

- **Node.js** (using **TypeScript**)

```sh
npx tsx test/run.test.ts
```

- **Bun**

```sh
bun test/run.test.ts
```

- **Deno**

```sh
deno run test/run.test.ts
```

:::tip
It's usually beneficial to have an exclusive _CI_ for each platform, especially to ensure better control in error cases.
:::
Expand Down
6 changes: 3 additions & 3 deletions website/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ const config: Config = {
},
},

onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'throw',
onBrokenAnchors: 'throw',
onBrokenLinks: 'log',
onBrokenMarkdownLinks: 'log',
onBrokenAnchors: 'log',

presets: [
[
Expand Down

This file was deleted.

Loading

0 comments on commit 4bfdfff

Please sign in to comment.