elm-test "Compilation failed" in CI
elm-test compiles your test modules and everything they import before running anything. A compile error in any reachable module stops the run with "Compilation failed" and zero tests executed.
What this error means
elm-test prints "Compilation failed while attempting to build ..." followed by the underlying Elm compiler error (NAMING ERROR, TYPE MISMATCH, MODULE NOT FOUND), and exits non-zero.
Compilation failed while attempting to build .../tests/Example.elm
-- TYPE MISMATCH ------------------------------------------- tests/Example.elm
The 1st argument to `equal` is not what I expect:Common causes
A test module does not compile
A test references a renamed value or passes the wrong type, so the compiler rejects it before any test runs.
A source module the tests import is broken
elm-test compiles imported source modules too; a build error in app code surfaces as a test compilation failure.
How to fix it
Fix the reported compiler error
- Read the Elm error block printed under "Compilation failed".
- Resolve it the same way you would for
elm make(naming, type, or module). - Re-run
elm-testto confirm the suite compiles and runs.
npx elm-testCompile sources first to localize
Run elm make on the app entry point to separate app build errors from test-only ones before running elm-test.
npx elm make src/Main.elm --output=/dev/null
npx elm-testHow to prevent it
- Run
elm-testlocally before pushing so test compile errors surface early. - Keep test imports in sync when app modules change names or types.
- Treat the suite as a build gate, since it will not run with any compile error.