Registry / testing / elm-test

elm-test

JSON →
library0.19.1-revision17jsnpmunverified

elm-test is the official Node.js command-line interface (CLI) for running test suites written with the `elm-explorations/test` Elm package. As of April 2026, the current stable version is `0.19.1-revision17`, with frequent patch-level releases (revisions) to address compatibility issues, bug fixes, and Node.js environment support. It functions by compiling Elm tests and executing them within a Node.js environment. A key differentiator is its tight coupling with specific versions of the `elm-explorations/test` Elm package; users must ensure compatibility between the CLI and the Elm testing library to avoid unexpected behavior, such as missing test distribution diagrams or compilation errors. It provides features like watch mode, selective test execution by file or glob, and various reporting formats.

npm install elm-test
INSTALL
IMPORT
SIG · ELM-TEST
E
elm-test
testingjavascriptv0.19.1-revision17
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

elm-test CLI
npx elm-test
elm-test (without npx or if not globally installed)
This package is primarily a CLI tool and does not expose JavaScript/TypeScript modules for direct `import` or `require` statements. Interaction is via command-line invocation, typically using `npx` or by defining scripts in `package.json`.

This quickstart demonstrates how to programmatically install, initialize, and run `elm-test` from a Node.js script, covering basic test execution patterns.

import { exec } from 'child_process'; import { promisify } from 'util'; const execPromise = promisify(exec); async function runElmTests() { try { console.log("1. Installing elm-test as a dev dependency..."); // Using npm install locally ensures `npx elm-test` works reliably. await execPromise('npm install --save-dev elm-test'); console.log("elm-test installed."); console.log("2. Initializing Elm test project (creates tests/Example.elm and configures elm.json)..."); // The --yes flag answers 'y' to prompts, making it non-interactive. const initOutput = await execPromise('npx elm-test init --yes'); console.log(initOutput.stdout); console.log("3. Running all tests in the project..."); const runOutput = await execPromise('npx elm-test'); console.log(runOutput.stdout); console.log("4. Running tests in a specific file (e.g., tests/Example.elm)..."); const specificFileOutput = await execPromise('npx elm-test tests/Example.elm'); console.log(specificFileOutput.stdout); console.log("Quickstart complete. Note: Watch mode (npx elm-test --watch) runs indefinitely."); } catch (error) { console.error(`Error during elm-test quickstart: ${error.message}`); console.error(`Stderr: ${error.stderr}`); } } runElmTests();
elm-test --version
Debug
Known issues
breakingStarting with `elm-test@0.19.1-revision10`, this CLI tool strictly requires `elm-explorations/test` version `2.0.0` or newer (specifically `2.x.x`). Older versions of `elm-explorations/test` are incompatible.
fix
Ensure your `elm.json` specifies `"elm-explorations/test": "2.x.x"` in your `test-dependencies` and run `elm install`.
affects: >=0.19.1-revision10
breakingNode.js 10 support was dropped in `elm-test@0.19.1-revision8`. The minimum required Node.js version is `12.20.0`.
fix
Upgrade your Node.js environment to version 12.20.0 or higher. For current stability and features, Node.js 18+ is recommended.
affects: >=0.19.1-revision8
gotchaWhen using `elm-test` versions `0.19.1-revision9` or older, running `elm-test init` could install `elm-explorations/test@2.0.0` or later, which has known incompatibilities (e.g., missing distribution diagrams) despite partial functionality.
fix
Always upgrade both `elm-test` CLI and `elm-explorations/test` package together to compatible versions. Refer to the official `elm-test` GitHub README for the version compatibility table.
affects: <=0.19.1-revision9
gotchaDue to a naming quirk, there is an `npm` package named `0.19.1` which is not the latest version. The latest stable versions are always named `0.19.1-revisionX`.
fix
Always install `elm-test` with the `revision` suffix, e.g., `npm install elm-test@latest` or `npm install elm-test@0.19.1-revision17` to ensure you get the most up-to-date and stable version.
affects: All
gotchaWhen specifying test files using globs (e.g., `src/**/*Tests.elm`), always wrap the glob pattern in double quotes. Without quotes, your shell might expand the glob prematurely, preventing `elm-test` from correctly handling file patterns, especially in watch mode or across different operating systems.
fix
Use `npx elm-test "src/**/*Tests.elm"` instead of `npx elm-test src/**/*Tests.elm`.
affects: All
gotchaOlder `elm-test` revisions had intermittent Node.js compatibility issues, notably `0.19.1-revision13` and `0.19.1-revision14` which broke Node.js 12 (and `npm` v10 for `14-18`). While `0.19.1-revision15` and later restored Node.js 12 support, always check release notes if encountering Node.js environment errors.
fix
For Node.js 12 environments, ensure you are using `elm-test@0.19.1-revision12` or `elm-test@0.19.1-revision15` or newer. For other versions, ensure your `npm` client is up-to-date (v10+ is recommended).
affects: 0.19.1-revision13, 0.19.1-revision14
Errors
Common errors & fixes
Error: Command failed: npx elm-test init --yes (or similar process crash output) / RuntimeError: unreachable
An older version of `elm-solve-deps-wasm` was causing runtime errors or `elm-test init` failures, or incompatibility with the Lamdera compiler.
fix
Upgrade `elm-test` to `0.19.1-revision11` or newer. This version bundles a fix for `RuntimeError: unreachable` and `0.19.1-revision16` fixed Lamdera compiler compatibility.
XML parsing error or crash when generating JUnit report (e.g., `elm-test --report junit`)
Test outputs from `elm-program-test` (or other Elm test libraries) contained characters disallowed in XML, causing the JUnit reporter to crash.
fix
Upgrade `elm-test` to `0.19.1-revision12` or newer. This version escapes disallowed XML characters to prevent crashes.
Error: Duplicate source directories (when `elm.json` contains `"source-directories": ["tests"]`)
A bug in `elm-test` versions prior to `0.19.1-revision13` would incorrectly report duplicate source directories if `tests` was explicitly listed in `elm.json`'s `source-directories`.
fix
Upgrade `elm-test` to `0.19.1-revision13` or newer.
Upgrade
Version history
0.19.1-revision17latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
elm-test — npm install elm-test · libregistry