Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
🐷 Poku is a flexible and easy-to-use Test Runner for Node.js, Bun and Deno that allows you to run parallel and sequential tests, plus high isolation level per test file
A flexible and easy-to-use Test Runner for Node.js, Bun and Deno that allows you to run parallel and sequential tests, plus high isolation level per test file.
Poku starts from the premise where tests come to help, not overcomplicate: runs test files in an individual process per file, shows progress and exits 🧙🏻
process.exit
at several depths on the same process nodeSequential | Parallel |
---|---|
npx poku test/unit,test/integration | npx poku --parallel test/unit,test/integration |
.test.
files, but you can customize it using the option filter
.Poku also includes the assert
method, keeping everything as it is, but providing human readability:
import { assert } from 'poku'; // Node and Bun
import { assert } from 'npm:poku'; // Deno
assert(true);
assert.deepStrictEqual(1, '1', 'My optional custom message');
npm install --save-dev poku
npm install --save-dev poku tsx
bun add --dev poku
import { poku } from 'npm:poku';
--allow-read
, --allow-env
and --allow-run
.import { poku } from 'poku';
await poku(['targetDirA', 'targetDirB']);
import { poku } from 'npm:poku';
await poku(['targetDirA', 'targetDirB']);
npx poku targetDirA,targetDirB
bun poku targetDirA,targetDirB
deno run npm:poku targetDirA,targetDirB
Website in Progress 🧑🏻🔧
Initially, the documentation is based on Node.js usage, but you can use all the options normally for both Bun and Deno.
poku(targetDirs: string | string[])
poku('targetDir');
poku(['targetDirA', 'targetDirB']);
By setting the directories as the last argument:
Since 1.3.0
npx poku targetDir
npx poku targetDirA,targetDirB
By using --include
option:
Since 1.0.0
npx poku --include='targetDir'
npx poku --include='targetDirA,targetDirB'
poku(targetDirs: string | string[], configs?: Configs)
parallel: boolean
Determines the mode of test execution across sequential or parallel modes.
/**
* @default
*
* Sequential mode
*/
poku(['...'], {
parallel: false,
});
/**
* Parallel mode
*/
poku(['...'], {
parallel: true,
});
Since 1.2.0
# Parallel mode
npx poku --parallel ./test
platform: "node" | "bun" | "deno"
Since 1.2.0
By default, Poku tries to identify the platform automatically, but you can set it manually:
/**
* Force Node.js (or tsx for TypeScript)
*
* @default 'node'
*/
poku('...', {
platform: 'node',
});
/**
* Force Bun
*/
poku('...', {
platform: 'bun',
});
/**
* Force Deno
*/
poku('...', {
platform: 'deno',
});
# Normal
npx poku --platform=node ./test
bun poku --platform=bun ./test
deno run npm:poku --platform=deno ./test
# Custom
# When you're developing using a platform, but maintain compatibility with others
npx poku --platform=bun ./test
bun poku --platform=deno ./test
deno run npm:poku --platform=node ./test
# ...
filter: RegExp
By default, Poku searches for .test.
files, but you can customize it using the filter
option.
Filter by path using Regex to match only the files that should be performed.
/**
* @default
*
* Testing all `*.test.*` files.
*/
poku(['...'], {
filter: /\.test\./,
});
/**
* Testing all `ts`, `js`, `mts` and `mjs` files
*/
poku(['...'], {
filter: /\.(m)?(j|t)s$/,
// filter: /\.(js|ts|mjs|mts)$/,
});
# Testing only a specific file
npx poku --filter='some-file' ./test
# Testing only a specific file
npx poku --filter='some-file|other-file' ./test
# Testing only paths that contains "unit"
npx poku --filter='unit' ./test
By using
FILTER
from Environment Variable, it will overwrite thefilter
option.
# Testing only a specific file
FILTER='some-file' npx poku ./test
# Testing only a specific file
FILTER='some-file|other-file' npx poku ./test
# Testing only paths that contains "unit"
FILTER='unit' npx poku ./test
exclude: RegExp | RegExp[]
Exclude by path using Regex to match only the files that should be performed.
Since 1.2.0
/**
* Excluding directories from tests
*/
poku(['...'], {
exclude: /\/(helpers|tools)\//,
});
/**
* Excluding directories from tests
*/
poku(['...'], {
exclude: [/\/helpers\//, /\/tools\//],
});
/**
* Excluding specific files from tests
*/
poku(['...'], {
exclude: /(index|common).test.ts/,
});
/**
* Excluding specific files from tests
*/
poku(['...'], {
exclude: [/index.test.ts/, /common.test.ts/],
});
/**
* Excluding directories and files from tests
*/
poku(['...'], {
exclude: /\/(helpers|tools)\/|(index|common).test.ts/,
});
/**
* Excluding directories and files from tests
*/
poku(['...'], {
exclude: [/\/helpers\//, /\/tools\//, /index.test.ts/, /common.test.ts/],
});
# Excluding directories and files from tests
npx poku --exclude='some-file-or-dir' ./test
# Excluding directories and files from tests
npx poku --exclude='some-file-or-dir|other-file-or-dir' ./test
quiet
Perform tests with no logs.
This option overwrites all
log
settings by exiting with code and no logs (see bellow).
poku(['...'], {
quiet: true,
});
Since 1.3.1
npx poku --quiet ./test
log
success
By default Poku doesn't shows succes logs, but you can enable it:
poku(['...'], {
log: {
success: true,
},
});
Since 1.3.1
npx poku --log-success ./test
Since 1.3.0
Poku includes the assert
method native from Node.js, keeping everything as it is, but providing human readability.
It supports both Bun and Deno.
But only if you want to, of course.
- import assert from 'node:assert';
+ import { assert } from 'poku';
assert(true);
- import assert from 'node:assert';
+ import { assert } from 'npm:poku';
assert(true);
assert(value[, message])
assert.deepEqual(actual, expected[, message])
assert.deepStrictEqual(actual, expected[, message])
assert.doesNotMatch(string, regexp[, message])
assert.doesNotReject(asyncFn[, error][, message])
assert.doesNotThrow(fn[, error][, message])
assert.equal(actual, expected[, message])
assert.fail([message])
assert.ifError(value)
assert.match(string, regexp[, message])
assert.notDeepEqual(actual, expected[, message])
assert.notDeepStrictEqual(actual, expected[, message])
assert.notEqual(actual, expected[, message])
assert.notStrictEqual(actual, expected[, message])
assert.ok(value[, message])
assert.rejects(asyncFn[, error][, message])
assert.strictEqual(actual, expected[, message])
assert.throws(fn[, error][, message])
You can follow the assert documentation from Node.js's documentation.
listFiles(targetDir: string, configs?: ListFilesConfigs)
Since 1.2.0
Returns all files in a directory, independent of their depth.
listFiles('some-dir');
filter
and exclude
options, as well as they are for poku
method.I'm continuously working to improve Poku. If you've got something interesting to share, feel free to submit a Pull Request. If you notice something wrong, I'd appreciate if you'd open an Issue.
FAQs
🐷 Poku makes testing easy for Node.js, Bun, Deno, and you at the same time.
The npm package poku receives a total of 300 weekly downloads. As such, poku popularity was classified as not popular.
We found that poku demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.