Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
🐷 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
Since 1.3.0
Poku includes the assert
method, keeping everything as it is, but providing human readability.
Available methods:
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.