Skip to main content
Version: v3.x.x

deno

Exclusive options for Deno platform.

allow​

Change permissions for Deno.

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

CLI​

deno run npm:poku --denoAllow='read,run'
deno run npm:poku --denoAllow='read=file.js,run'

Clear all permissions:

deno run npm: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​

deno run npm:poku --denoDeny='write,sys'
deno run npm:poku --denoDeny='env=HOME,write'

API​

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

cjs (Deno v1)​

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

cjs: boolean | string[]

Important

From Deno v2, simply set the type to commonjs in your package.json or use the .cjs extension.

For Deno v1, you can follow the instructions bellow.

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​

deno run npm:poku --denoCjs
deno run npm:poku --denoCjs='.js,.cjs'

API​

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