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