# "elm test" for 0.19

**URL:** https://discourse.elm-lang.org/t/elm-test-for-0-19/1748
**Category:** Learn
**Created:** [August 26, 2018, 5:30pm UTC](https://discourse.elm-lang.org/t/elm-test-for-0-19/1748 "2018-08-26T17:30:34Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![rob](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/rob/32/589_2.png) [@rob](https://discourse.elm-lang.org/u/rob)
#### Post date: [August 26, 2018, 5:30pm UTC](https://discourse.elm-lang.org/t/elm-test-for-0-19/1748/1 "2018-08-26T17:30:34Z")

</div>

The documentation for `package.json` indicates that `elm test` exists, however it doesn’t seem to ship with the elm install. Is there a new `elm-test` command to be found somewhere, or should we wait for [elm-community/elm-test](https://github.com/elm-community/elm-test) to be updated?

---

<div class="post-metadata">

### Author: ![rtfeldman](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/rtfeldman/32/50_2.png) [@rtfeldman](https://discourse.elm-lang.org/u/rtfeldman)
#### Post date: [August 26, 2018, 6:12pm UTC](https://discourse.elm-lang.org/t/elm-test-for-0-19/1748/2 "2018-08-26T18:12:41Z")

</div>

I’m not sure where those docs are, but it sounds like they’re pointing to the wrong thing!

Here is the elm-test CLI:

> **[elm-test](https://www.npmjs.com/package/elm-test)**
>
> Run elm-test suites.

…and here is the 0.19 package:

> **[elm-explorations/test](https://github.com/elm-explorations/test)**
>
> Write unit and fuzz tests for Elm code. Contribute to elm-explorations/test development by creating an account on GitHub.

---

<div class="post-metadata">

### Author: ![rob](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/rob/32/589_2.png) [@rob](https://discourse.elm-lang.org/u/rob)
#### Post date: [August 26, 2018, 6:48pm UTC](https://discourse.elm-lang.org/t/elm-test-for-0-19/1748/3 "2018-08-26T18:48:05Z")

</div>

The documentation I mentioned are [application.md](https://github.com/elm/compiler/blob/master/docs/elm.json/application.md) and [package.md](https://github.com/elm/compiler/blob/master/docs/elm.json/package.md) linked from the 0.19 release notes. One mentions `elm-test`, the other `elm test`.

It turns out I did install the right `elm-test` then from NPM, but it behaves like it’s meant for 0.18, which is what caused me to ask the question. I seem to be doing something wrong:

```auto
$ ls
...
elm.json
src
tests
$ elm test
There is no test command. Try repl or init instead?

Run `elm` with no arguments to get more hints.

$ elm-test
It looks like you're running elm-test from within your tests directory.

Please run elm-test from your project's root directory, where its elm-package.json lives!
$ elm --version
0.19.0
$ elm-test --version
0.18.12

```

---

<div class="post-metadata">

### Author: ![rofrol](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/rofrol/32/60_2.png) [@rofrol](https://discourse.elm-lang.org/u/rofrol)
#### Post date: [August 26, 2018, 7:41pm UTC](https://discourse.elm-lang.org/t/elm-test-for-0-19/1748/4 "2018-08-26T19:41:33Z")

</div>

Have you tried [0.19.0-beta4](https://www.npmjs.com/package/elm-test/v/0.19.0-beta4)?

---

<div class="post-metadata">

### Author: ![rob](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/rob/32/589_2.png) [@rob](https://discourse.elm-lang.org/u/rob)
#### Post date: [August 26, 2018, 7:57pm UTC](https://discourse.elm-lang.org/t/elm-test-for-0-19/1748/5 "2018-08-26T19:57:09Z")

</div>

> Have you tried [0.19.0-beta4 3](https://www.npmjs.com/package/elm-test/v/0.19.0-beta4)?

I have now, thanks. `npm install elm-test@0.19.0-beta4`. It seems not ready, I’m getting a host of different errors. Initially without the test dependencies specified and possibly with connectivity issues.

```auto
$ elm-test 
Unhandled exception while running the tests: SyntaxError: Unexpected token E in JSON at position 0
    at Object.parse (native)
    at askElmForMissingTransitiveDependencies (.../node_modules/elm-test/lib/elm-test.js:566:21)
$ elm-test
elm-test internal error: got an unexpected result from 'elm make' when validating transitive dependencies. Please report this at https://github.com/rtfeldman/node-test-runner/issues
$ elm-test init
Error reading elm.json: Error: ENOENT: no such file or directory, open '.../node_modules/elm-test/templates/tests/elm.json'
$ elm-test
Unhandled exception while running the tests: TypeError: version.split is not a function
    at .../node_modules/elm-test/lib/elm-test.js:451:27

```

---

<div class="post-metadata">

### Author: ![mfeineis](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/mfeineis/32/104_2.png) [@mfeineis](https://discourse.elm-lang.org/u/mfeineis)
#### Post date: [August 27, 2018, 12:45pm UTC](https://discourse.elm-lang.org/t/elm-test-for-0-19/1748/6 "2018-08-27T12:45:53Z")

</div>

You may have to add the `--compiler=/path/to/your/elm/compiler` flag if you’ve not installed 0.19 globally

---

<div class="post-metadata">

### Author: ![rob](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/rob/32/589_2.png) [@rob](https://discourse.elm-lang.org/u/rob)
#### Post date: [August 27, 2018, 4:50pm UTC](https://discourse.elm-lang.org/t/elm-test-for-0-19/1748/7 "2018-08-27T16:50:54Z")

</div>

Thanks, but nope, that doesn’t help. Would have been a surprise given that `elm` on the PATH is version 0.19.

---

<div class="post-metadata">

### Author: ![rob](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/rob/32/589_2.png) [@rob](https://discourse.elm-lang.org/u/rob)
#### Post date: [August 27, 2018, 8:24pm UTC](https://discourse.elm-lang.org/t/elm-test-for-0-19/1748/8 "2018-08-27T20:24:49Z")

</div>

So, small progress. It turns out that the test-dependencies fragment generated by elm-test is completely wrong. Removing direct/indirect and filling the version bound to include an upper bound gets me further.

---

<div class="post-metadata">

### Author: ![myrho](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/myrho/32/1093_2.png) [@myrho](https://discourse.elm-lang.org/u/myrho)
#### Post date: [August 28, 2018, 9:31am UTC](https://discourse.elm-lang.org/t/elm-test-for-0-19/1748/9 "2018-08-28T09:31:00Z")

</div>

I also struggled with switching tests of my package myrho/elm-round from 18 to 19. I ran into similar issues. My learnings:

- There must not be an `elm.json` file in your tests directory. There need only be your elm files with `Test`s in it.
- Cleanup your workspace: Delete `elm-stuff`.
- in your `elm.json` file’s `test-dependencies` section, add the line `“elm-explorations/test”: “1.0.0 \<= v \< 2.0.0”
- Here is a working package that helped me also: [https://github.com/lukewestby/elm-string-interpolate](https://github.com/lukewestby/elm-string-interpolate). Its updated for elm 0.19 in source and tests.

---

<div class="post-metadata">

### Author: ![rtfeldman](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/rtfeldman/32/50_2.png) [@rtfeldman](https://discourse.elm-lang.org/u/rtfeldman)
#### Post date: [August 29, 2018, 2:45pm UTC](https://discourse.elm-lang.org/t/elm-test-for-0-19/1748/10 "2018-08-29T14:45:50Z")

</div>

> [@rob](#):
>
> the test-dependencies fragment generated by elm-test

Hmm, what fragment is this? I’m not sure what this is referring to, sorry!

---

<div class="post-metadata">

### Author: ![rob](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/rob/32/589_2.png) [@rob](https://discourse.elm-lang.org/u/rob)
#### Post date: [August 30, 2018, 11:38am UTC](https://discourse.elm-lang.org/t/elm-test-for-0-19/1748/11 "2018-08-30T11:38:19Z")

</div>

I had used `elm-test init` which put a test-dependencies section in elm.json, including a dependency on `elm-explorations/test` with a fixed version. I think the core of the issue was that I was trying to test a package, while `elm-test` assumes that you’re testing an `app` and sets things up accordingly. This was quite hard to figure out because it doesn’t say very clearly what goes wrong.

---

<div class="post-metadata">

### Author: ![bill.peregoy](https://avatars.discourse-cdn.com/v4/letter/b/ac8455/32.png) [@bill.peregoy](https://discourse.elm-lang.org/u/bill.peregoy)
#### Post date: [September 2, 2018, 5:31pm UTC](https://discourse.elm-lang.org/t/elm-test-for-0-19/1748/12 "2018-09-02T17:31:06Z")

</div>

I’m having some really basic issues getting elm-test working with 0.19. I installed what I think is the correct version of elm-test:

```auto
elm-quickstart master % elm-test --version                
0.19.0-beta4

```

But when I try to run `elm-test init`, I get this:

```auto
elm-quickstart master % elm-test init
Created /Users/bill/Projects/elm-quickstart/tests
Error reading elm.json: Error: ENOENT: no such file or directory, open '/Users/bill/.nvm/versions/node/v8.7.0/lib/node_modules/elm-test/templates/tests/elm.json'

```

Any idea what I’m missing?

---

<div class="post-metadata">

### Author: ![dmy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/dmy/32/702_2.png) [@dmy](https://discourse.elm-lang.org/u/dmy)
#### Post date: [September 2, 2018, 5:52pm UTC](https://discourse.elm-lang.org/t/elm-test-for-0-19/1748/13 "2018-09-02T17:52:38Z")

</div>

@bill.peregoy, `elm-test@beta` is now [`0.19.0-beta6`](https://www.npmjs.com/package/elm-test/v/0.19.0-beta6), so I would remove the build artifact directory `elm-stuff` and try again with the last release. Also check that you use the last [`elm-exploration/test`](https://package.elm-lang.org/packages/elm-explorations/test/1.1.0/) version, which is `1.1.0`.

---

<div class="post-metadata">

### Author: ![bill.peregoy](https://avatars.discourse-cdn.com/v4/letter/b/ac8455/32.png) [@bill.peregoy](https://discourse.elm-lang.org/u/bill.peregoy)
#### Post date: [September 2, 2018, 7:03pm UTC](https://discourse.elm-lang.org/t/elm-test-for-0-19/1748/14 "2018-09-02T19:03:23Z")

</div>

Thanks @dmy but I still get the same error with the beta6 version of elm-test.

---

<div class="post-metadata">

### Author: ![rtfeldman](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/rtfeldman/32/50_2.png) [@rtfeldman](https://discourse.elm-lang.org/u/rtfeldman)
#### Post date: [September 3, 2018, 10:49am UTC](https://discourse.elm-lang.org/t/elm-test-for-0-19/1748/15 "2018-09-03T10:49:13Z")

</div>

@bill.peregoy the beta doesn’t support `init` yet, sorry! If you want to track when it’ll be added, this is the WIP PR: [https://github.com/rtfeldman/node-test-runner/pull/265](https://github.com/rtfeldman/node-test-runner/pull/265)

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)
#### Post date: [September 13, 2018, 10:49am UTC](https://discourse.elm-lang.org/t/elm-test-for-0-19/1748/16 "2018-09-13T10:49:16Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
