Lisplog

Blogging in Lisp

Search

How do I run elm-test in Elm 0.19?

Submitted by Bill St. Clair on Mon, 17 Sep 2018 00:24:33 GMT

This is a FAQ, so I'm making a blog post to answer it.

elm-test is still in beta for Elm 0.19. To install it:

$ npm install -g elm-test@beta

The tests directory no longer needs an elm-package.json file (nor does it need elm.json).

Your top-level elm.json file needs to include the following:

    "test-dependencies": {
        "elm-explorations/test": "1.0.0 <= v < 2.0.0"
    }

The easiest way to get it there is with elm-test itself. The following will create a tests directory, containing an example test file, Example.elm, and will add test-dependencies to elm.json.

$ elm-test init

That's it. There is not yet support for running elm-test in the browser, nor is there support for testing DOM output.

billstclair/elm-localstorage is configured with a tests directory to test its JSON encoders and decoders: github.com/billstclair/elm-localstorage. To run the tests:

$ git clone git@github.com:billstclair/elm-localstorage.git
$ cd elm-localstorage
$ elm-test

Add comment   Edit post   Add post

Previous Posts:

CLtL2 on Kludges
iPhone Xs Pricing
New Elm Package: billstclair/elm-port-funnel
Building the Elm compiler
elm-websocket-client
Server Updated to Ubuntu 16.04LTS
XKCD April Fools 2018
JSMaze Returns, in Elm!
elm-svg-button
NearlyFreeSpeech.NET Stupid Bureaucratic Rules Compliance Department