wellwelwel / poku Goto Github PK
View Code? Open in Web Editor NEW🐷 Poku makes testing easy for Node.js, Bun & Deno at the same time.
Home Page: https://poku.io
License: MIT License
🐷 Poku makes testing easy for Node.js, Bun & Deno at the same time.
Home Page: https://poku.io
License: MIT License
In fact, all the lines are covered, but not for tests. It's for use, due to my helper tools for rewriting files and ensuring compatibility with Node.js in older versions, Bun and Deno.
To see the actual coverage status, just run npm run test:c8
. This will use Docker to ensure that only the final files are tested, but Codecov shows "unknown" status and throws an error when uploading these coverage results for some reason.
Sorry about that, as soon as possible I would like to figure it out 💙
Source: https://youtu.be/iDaBo7ge604?si=x8hWjOH8ffHHOJ_6&t=2674
Credits to @ErickWendel 🇧🇷
In the same approach for assert
, allow users to use all the native approaches in Poku:
From (Node.js homepage):
// tests.mjs
import assert from 'node:assert';
import test from 'node:test';
test('that 1 is equal 1', () => {
assert.strictEqual(1, 1);
});
test('that throws as 1 is not equal 2', () => {
// throws an exception because 1 != 2
assert.strictEqual(1, 2);
});
// run with `node tests.mjs`
To (Poku):
// tests.mjs
import { test, assert } from 'poku';
test('that 1 is equal 1', () => {
assert.strictEqual(1, 1);
});
test('that throws as 1 is not equal 2', () => {
// throws an exception because 1 != 2
assert.strictEqual(1, 2);
});
// run with `npx poku tests.mjs`
describe
and it
.Sometimes, the file path is not parsed when using Poku's assert
with Bun.
Basicamente quando eu tento executar os testes utilizando o Bun como runtime ele funciona normalmente, mas ao importar algo relacionado ao Bun dentro do arquivo de teste, o poku quebra, simplesmente não executa e crasha sem mensagem de erro.
Primeiramente eu comecei tentando importar o mock do jest de dentro do "bun:test" e crashava, ai tentei importar outras coisas de dentro do bun, de outras bibliotecas do bun e crashava. Não importa o que eu importe, se for diretamente do bun, crasha.
WSL2 Rodando Arch Linux
Crie um arquivo de teste, no meu caso, eu criei da seguinte forma:
Depois dentro dele, coloque um assert pra testar e antes dele, importe qualquer lib do bun.
Exemplo:
import { assert } from "poku";
import { Database } from "bun:sqlite";
assert(true, "Poku test");
O output desse teste é esse:
Eu imagino que esse erro seja originado porque os testes são executados com node ao invés do próprio bun, (talvez alguma configuração que eu não soube fazer?).
Quando é usado Typescript, os arquivos são executados com npx tsx
e com Javascript, node
.
Como ele executa com node e não com o próprio Bun, imagino eu que quebre na hora de importar algo diretamente do Bun.
The startScript
currently doesn't work for Bun and Deno.
startScript
works?spawn
to start your script in a background process.end()
, the current process and all its sub-processes will be terminatedCtrl+C
), it will terminate all the background process and all its sub-processesUsing Node.js, it will close all subprocesses when closing the main process.
However, on Bun and Deno, when the main process is finished, all subprocesses remain open and only the main process is closed.
PRs are welcome 🤝
By default Poku uses --allow-run
, --allow-env
, --allow-read
that are required to everything works fine, but it needs to improve a way to pass or replace the permissions.
Currently, functions are displayed as it is ("() => {}"
) and Regex are converted to string ("/rule/"
), but the same doesn't is valid when they are inside an array, that shows function as "null"
and Regex as "{}"
.
npx poku --parallel --concurrency=3
await poku(['.'], {
parallel: true,
concurrency: 3,
});
Use default value as 0
(no limit).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.