Run, watch, and inspect Haskell Cabal and Stack tests directly from the VS Code Testing sidebar and editor gutter.
Features
Testing Sidebar & Gutter Play Buttons — Discovers packages and test-suite targets from cabal.project, *.cabal, stack.yaml, and package.yaml (hpack) files.
Multi-Framework Support — Works with Hspec, Tasty, and custom exitcode-stdio-1.0 test runners.
Watch Mode (Continuous Run) — Click the Testing eye icon to rerun tests automatically when you save .hs, .lhs, .cabal, package.yaml, or stack.yaml files.
Parametrized Test Discovery — Uses --dry-run (Hspec) and --list-tests (Tasty) to list dynamically generated test cases.
Timings, Diffs & Failure Navigation — Displays per-test durations, expected/actual diffs, and jumps straight to the failing File.hs:line:col.
DevContainer Friendly — Set haskellTestRunner.commandPrefix (e.g. ./exec.sh) to run cabal test or stack test inside Docker from a host VS Code window.
Quick Start
Install Haskell Test Runner from the VS Code Marketplace (or run code --install-extension arjunswaj.haskell-test-runner).
Open any Haskell Cabal or Stack workspace (*.cabal, cabal.project, stack.yaml, or package.yaml).
Open the Testing sidebar (beaker icon) or click the green play icon next to any test.
Requirements
GHC and Cabal or Stack available on PATH (locally, inside a Dev Container, or via haskellTestRunner.commandPrefix).
Extension Settings
Setting
Default
Description
haskellTestRunner.buildTool
"auto"
Build tool selection ("auto", "cabal", or "stack").
haskellTestRunner.commandPrefix
""
Optional command prefix prepended before the build tool (e.g. "./exec.sh").
haskellTestRunner.cabalPath
"cabal"
Path to the cabal executable.
haskellTestRunner.stackPath
"stack"
Path to the stack executable.
haskellTestRunner.extraTestArgs
[]
Extra arguments appended to cabal test or stack test.
haskellTestRunner.runtimeDiscovery
true
Discover dynamic/parametrized Hspec and Tasty cases at runtime.