Skip to main content
Version: v2.x.x

deno

Exclusive options for Deno platform.

allow​

Change permissions for Deno.

By default Poku uses --allow-run, --allow-env, --allow-read, allow-hrtime and --allow-net.

CLI​

npx poku --denoAllow='read, run'
npx poku --denoAllow='read=file.js, run'

Clear all permissions:

npx poku --denoAllow=''

API​

poku('./test', {
deno: {
allow: ['read', 'run' /* ... */],
},
});
poku('./test', {
deno: {
allow: ['read=file.js', 'run' /* ... */],
},
});

Clear all permissions:

poku('./test', {
deno: {
allow: [],
},
});

deny​

Change permissions for Deno.

CLI​

npx poku --denoDeny='write, sys'
npx poku --denoDeny='env=HOME, write'

API​

poku('./test', {
deno: {
deny: ['write', 'sys' /* ... */],
},
});
poku('./test', {
deno: {
deny: ['env=HOME', 'write' /* ... */],
},
});

cjs​

poku(targetPaths: string | string[], configs?: Configs)

cjs: boolean | string[]

Now, it's possible to run tests that use require, module.exports and module directly with Deno πŸŽ‰

It's a great feature to test if a project created primarily in Node.js or Bun is also compatible with Deno without the need to transpile the code or use workarounds.

To run CommonJS with Deno, you can use:

CLI​

npx poku --denoCjs
npx poku --denoCjs='.js,.cjs'

API​

await poku('./test', {
deno: {
cjs: true,
},
});
await poku('./test', {
deno: {
cjs: ['.js', '.cjs' /* ... */],
},
});