Skip to content
Latchkey

deno task: Run deno.json Scripts

deno task runs a named command from the "tasks" field of deno.json with a cross-platform shell.

deno task is Deno's npm-scripts equivalent. CI calls one task name and the definition lives in deno.json, so the command stays consistent everywhere.

What it does

deno task looks up a key under "tasks" in deno.json and runs its value through a built-in shell that works the same on Linux, macOS, and Windows. Listing with no arguments prints available tasks.

Common usage

Terminal
deno task            # list tasks
deno task test
deno task build --release
# tasks can reference other commands
# deno.json: { "tasks": { "ci": "deno fmt --check && deno lint && deno test" } }
deno task ci

Options

ItemWhat it does
<task-name>The key under "tasks" in deno.json to run
-- <args>Forward extra arguments to the task command
--cwd <dir>Run the task from a different working directory
"tasks" fieldWhere task commands are defined in deno.json

In CI

Define a single "ci" task that chains fmt, lint, check, and test, then call deno task ci from the workflow. That keeps the pipeline definition in deno.json so local and CI runs match exactly.

Common errors in CI

"Task not found: <name>" means the key is missing or misspelled in deno.json, or the wrong config file is being picked up. "No config file found" means deno.json is absent in the working directory; pass --config or cd into the project. A task that fails mid-chain stops at the first non-zero exit.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →