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' /* ... */],
},
});