Getting started
This path installs the hunt binary and the @slopkit/hunt SDK, writes one Scenario and its Step definitions, and runs it. You need Linux on x86-64, curl, and Node.js with npm.
The first success is a passing Scenario in your terminal. Hosted runs, Snapshots, Stubs and CI come after that.
Install the CLI
Run the install script. It reads the stable channel from hunt.slopkit.dev, downloads the release binary for x86-64 Linux, checks its SHA-256 against the project's package registry, installs it into ~/.local/bin, and runs hunt --version. The binary is self-extracting and needs no Nix. To build from source with Nix instead, see the repo README.
curl -fsSL https://hunt.slopkit.dev/install.sh | sh
If ~/.local/bin is not on your PATH, add it for this shell, then check the install:
export PATH="$HOME/.local/bin:$PATH" hunt --version
Match:
hunt 0.1.0
Four environment variables change what the script does: HUNT_VERSION installs an exact version instead of the channel, HUNT_CHANNEL picks another channel, HUNT_INSTALL_DIR sets the directory, and HUNT_SHA256 sets the expected checksum instead of looking it up.
If you cannot run the script, download the binary yourself:
mkdir -p ~/.local/bin curl -fsSL -o ~/.local/bin/hunt "https://gitlab.techtailors.net/api/v4/projects/slopkit%2Fhunt/packages/generic/hunt/0.1.0/hunt-linux-amd64" chmod +x ~/.local/bin/hunt
The binary updates itself. Run hunt update later to move to the newest release on the stable channel. Today it prints:
hunt update
cram: hunt 0.1.0 is already up to date
Install the SDK
Step definitions import @slopkit/hunt. Make a project directory and install the SDK from the project's npm registry. Hunt starts your Steps in a Node process, and Node prints a warning for TypeScript Step files unless package.json sets type to module, so the first file sets it.
mkdir shop-e2e
cd shop-e2e
mkdir -p features steps
echo '{ "type": "module" }' > package.json
echo '@slopkit:registry=https://gitlab.techtailors.net/api/v4/projects/973/packages/npm/' > .npmrc
npm install @slopkit/hunt
Match the last lines of the install. The package count and timing can differ:
added 4 packages, and audited 5 packages in 592ms found 0 vulnerabilities
The registry needs no login. The .npmrc line points the @slopkit scope at it.
Write a Scenario
A Feature is a user-facing capability. A Scenario is one named example of it, written as Given, When and Then Steps.
Tell Hunt where the Features and Step definitions are, and which runtime hosts the Steps.
cat > hunt.toml <<'EOF' features = "features" steps = ["steps/**/*.ts"] runtime = ["node"] EOF
Write the Scenario. The @smoke tag is a tag you can select on later.
cat > features/cart.feature <<'EOF'
Feature: Cart
@smoke
Scenario: Adding two items
Given an empty cart
When I add 2 items at 5 euros each
Then the cart total is 10 euros
EOF
Write the Step definitions. {int} is a Cucumber Expression parameter. A Step fails when it throws.
cat > steps/cart.ts <<'EOF'
import { Given, Then, When, type Context } from "@slopkit/hunt";
const cart = (ctx: Context) => ctx.state as { total: number };
Given("an empty cart", (ctx) => {
cart(ctx).total = 0;
});
When("I add {int} items at {int} euros each", (ctx, count: number, price: number) => {
cart(ctx).total += count * price;
});
Then("the cart total is {int} euros", (ctx, expected: number) => {
const { total } = cart(ctx);
if (total !== expected) throw new Error(`expected ${expected}, got ${total}`);
});
EOF
Run it
List what Hunt found.
hunt list
The path in brackets is the absolute path to your Feature file, so yours will differ.
Feature: Cart
Scenario: Adding two items @smoke [<project>/features/cart.feature:4]
Given an empty cart
When I add 2 items at 5 euros each
Then the cart total is 10 euros
Run the Scenarios tagged @smoke.
hunt run --tags @smoke
Match this output. The duration will differ. The command exits 0.
✓ Cart › Adding two items (8 ms)
✓ Given an empty cart
✓ When I add 2 items at 5 euros each
✓ Then the cart total is 10 euros
1 scenarios: 1 passed, 0 failed, 0 undefined, 0 ambiguous
Change 10 euros to 11 euros in the Then line of features/cart.feature, then run hunt run again. The failing Step shows its error, and the command exits 1.
✗ Cart › Adding two items (6 ms)
✓ Given an empty cart
✓ When I add 2 items at 5 euros each
✗ Then the cart total is 11 euros
expected 11, got 10
1 scenarios: 0 passed, 1 failed, 0 undefined, 0 ambiguous
Change it back to 10 euros.
Run Steps once without a Feature file. This is an Exploration, and nothing is recorded in the Baseline.
hunt explore 'Given an empty cart' 'When I add 3 items at 4 euros each'
Match:
Exploration (nothing is recorded in the Baseline)
✓ Exploration › Exploration (5 ms)
✓ Given an empty cart
✓ When I add 3 items at 4 euros each
Check the files
shop-e2e/ ├── .npmrc ├── features/cart.feature ├── hunt.toml ├── node_modules/@slopkit/hunt ├── package-lock.json ├── package.json └── steps/cart.ts
Next steps
Open the docs for the commands, hunt.toml and the SDK. Source and issues are in the product repo.
Verified
Run on this machine (Linux x86-64, Node 24.22.2, npm 11.19.1) with HOME and every XDG directory pointed at an empty scratch directory, and an empty project directory, in the order shown, with the real output above. Paths in hunt list were shortened.
Passed:
curl -fsSL https://hunt.slopkit.dev/install.sh | sh, with the script served unchanged from this repo on localhost andHUNT_INSTALL_DIRpointed at the scratch directory. It read the livestablechannel and installed 0.1.0 with no credentials. Thenhunt --version,hunt updateandhunt channel.HUNT_VERSION=0.1.0installed the same release, and an unknownHUNT_CHANNELstopped withno release at.- The direct
curldownload of the 0.1.0 release binary with no credentials,chmod +x,hunt --version. npm install @slopkit/huntwith the.npmrcline above, with no credentials.- The three
cat > ... <<'EOF'files,hunt list,hunt run --tags @smoke(exit 0),hunt runafter changing the expected total to 11 (exit 1),hunt explore. The failing run was produced withsedinstead of an editor, with the same result.
Not run:
- Building from source with Nix (
nix build .#hunt, see the repo README). - Anything on Bun, Deno, the browser, Stubs, Clock Shifts, the hosted service or CI.