Skip to content

Commit

Permalink
feat(docs): introduce Portuguese BR docs (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
wellwelwel committed Mar 3, 2024
1 parent 78e7bf1 commit 9a6dc87
Show file tree
Hide file tree
Showing 36 changed files with 2,020 additions and 4 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

<img align="right" width="128" height="128" alt="Logo" src="https://github.com/raw/wellwelwel/poku/main/.github/assets/readme/poku.svg">

[**English**](https://poku.io/docs) | [**Português (BR)**](https://poku.io/pt-BR/docs)

**Poku** is your Test Runner Pet for [**Node.js**][node-version-url], [**Bun**][bun-version-url] and [**Deno**][deno-version-url].

[![Node.js Version][node-version-image]][node-version-url]
Expand Down Expand Up @@ -47,6 +49,7 @@ By creating **Poku**, my aim is to show that testing can be simpler 🌱
- No configurations
- Supports **ESM** and **CJS**
- High **isolation** level per file
- **Poku** is [**100%** documented](https://poku.io/docs)
- Zero external dependencies
- **Parallel** and **Sequential** runs
- Designed to be highly intuitive
Expand Down
2 changes: 1 addition & 1 deletion website/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ Please check the [**SECURITY.md**](https://github.com/wellwelwel/poku/blob/main/

## Acknowledgements

[![Contributors](https://img.shields.io/github/contributors/wellwelwel/poku)](https://github.com/wellwelwel/poku/graphs/contributors)
[![Contributors](https://img.shields.io/github/contributors/wellwelwel/poku?label=Contributors)](https://github.com/wellwelwel/poku/graphs/contributors)

<a
href='https://github.com/wellwelwel/poku/graphs/contributors'
Expand Down
17 changes: 17 additions & 0 deletions website/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ const config: Config = {
trailingSlash: false,
favicon: 'favicon.ico',

i18n: {
defaultLocale: 'en',
locales: ['en', 'pt-BR'],
localeConfigs: {
en: {
label: '🇺🇸 English',
},
'pt-BR': {
label: '🇧🇷 Português (Brasil)',
},
},
},

onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'throw',
onBrokenAnchors: 'throw',
Expand Down Expand Up @@ -72,6 +85,10 @@ const config: Config = {
'aria-label': 'GitHub Sponsor',
},
{ type: 'search', position: 'right' },
{
type: 'localeDropdown',
position: 'right',
},
],
},
prism: {
Expand Down
38 changes: 38 additions & 0 deletions website/i18n/pt-BR/docusaurus-plugin-content-docs/current.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"version.label": {
"message": "Next",
"description": "The label for version current"
},
"sidebar.docs.category.Documentation": {
"message": "Documentação",
"description": "The label for category Documentation in sidebar docs"
},
"sidebar.docs.category.poku": {
"message": "poku",
"description": "The label for category poku in sidebar docs"
},
"sidebar.docs.category.Configs": {
"message": "Opções",
"description": "The label for category Configs in sidebar docs"
},
"sidebar.docs.category.Helpers": {
"message": "Auxiliares",
"description": "The label for category Helpers in sidebar docs"
},
"sidebar.docs.category.beforeEach and afterEach": {
"message": "beforeEach e afterEach",
"description": "The label for category beforeEach and afterEach in sidebar docs"
},
"sidebar.docs.category.Examples": {
"message": "Exemplos",
"description": "The label for category Examples in sidebar docs"
},
"sidebar.docs.category.Mock": {
"message": "Mock",
"description": "The label for category Mock in sidebar docs"
},
"sidebar.docs.category.Use Cases": {
"message": "Casos de Uso",
"description": "The label for category Use Cases in sidebar docs"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,290 @@
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Comparando Test Runners

**Comparações usando **Node.js**, **TypeScript** (_sem compilar_) e **ESM** para mostrar um simples teste de erro:**

- Vamos começar desde a instalação 🔬

<Tabs>
<TabItem default value='Poku'>

## [Poku](https://github.com/wellwelwel/poku)

### Instalação

```bash
npm i -D poku tsx
```

> ~10M
<hr />

### Criando o arquivo de teste

> _test/index.test.ts_
```ts
import { assert } from 'poku';

assert.deepStrictEqual('1', 1, 'Número não deve ser uma string');
```

<hr />

### Executando o teste

```bash
npx poku
```

<hr />

É isso 🎉

:::tip

O **Poku** não usa **`describe`** ou **`it`**, visto que a mensagem já está no **`assert`**.

- O **`assert`** do **Poku** é apenas uma abstração do **`assert`** original do **Node.js**. <br />
- Isso significa: <ins>**Sem necessidade de novos aprendizados**</ins> 🎉

:::

Adote um **Poku** pra você 🩵

</TabItem>
<TabItem value='Jest'>

## [Jest](https://github.com/jestjs/jest)

### Instalação

```bash
npm i -D jest @types/jest ts-jest
```

> ~65M
<hr />

### Configurando o TypeScript

> Adicione no seu _tsconfig.json_
```json
{
"compilerOptions": {
"esModuleInterop": true
}
}
```

<hr />

### Configurando o Jest

> _jest.config.js_
```js
export default {
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['**/test/**/*.test.ts'],
};
```

<hr />

### Criando o arquivo de teste

> _test/index.test.ts_
```ts
describe('Comparação de Tipos', () => {
test('Número não deve ser uma string', () => {
expect('1').toStrictEqual(1);
});
});
```

<hr />

### Executando o teste

```bash
npx jest
```

</TabItem>
<TabItem value='Mocha + Chai'>

## [Mocha](https://github.com/mochajs/mocha) + [Chai](https://github.com/chaijs/chai)

### Instalação

```bash
npm i -D mocha @types/mocha chai @types/chai tsx
```

> ~18M
<hr />

### Configurando o Mocha

> _.mocharc.json_
```json
{
"require": "tsx",
"extension": ["ts"],
"spec": "./test/**/*.test.ts"
}
```

<hr />

### Criando o arquivo de teste

> _test/index.test.ts_
```ts
import { expect } from 'chai';

describe('Comparação de Tipos', () => {
it('Número não deve ser uma string', () => {
expect('1').to.deep.equal(1);
});
});
```

<hr />

### Executando o teste

```bash
npx mocha
```

</TabItem>
<TabItem value='Vitest'>

## [Vitest](https://github.com/vitest-dev/vitest)

### Instalação

```bash
npm i -D vitest ts-node
```

> ~66M
<hr />

### Configurando o Vitest

> _vitest.config.ts_
```ts
import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
include: ['test/**/*.test.ts'],
globals: true,
environment: 'node',
},
});
```

<hr />

### Criando o arquivo de teste

> _test/index.test.ts_
```ts
import { describe, it, expect } from 'vitest';

describe('Comparação de Tipos', () => {
it('Número não deve ser uma string', () => {
expect('1').toStrictEqual(1);
});
});
```

<hr />

### Executando o teste

```bash
npx vitest run
```

</TabItem>
<TabItem value='AVA'>

## [AVA](https://github.com/avajs/ava) (CJS)

:::info

Não consegui testar o **AVA** como **ESM** sem antes compilar o **TypeScript**. <br />
Por favor, envie um _PR_ se você souber como chegar a essa abordagem.

- Relacionado: [avajs/ava#3308](https://github.com/avajs/ava/discussions/3308).

:::

### Instalação

```bash
npm i -D ava tsx
```

> ~26M
<hr />

### Configurando o AVA

> Include in the _package.json_:
```json
{
"ava": {
"files": ["test/**/*.test.ts"],
"extensions": {
"ts": "commonjs"
},
"nodeArguments": ["--import=tsx"]
}
}
```

<hr />

### Criando o arquivo de teste

> _test/index.test.ts_
```ts
import test from 'ava';

test('Número não deve ser uma string', (t) => {
t.deepEqual('1', 1);
});
```

<hr />

### Executando o teste

```bash
npx ava
```

</TabItem>
</Tabs>
Loading

0 comments on commit 9a6dc87

Please sign in to comment.