Cannot get elm-community/elm-test to work as advertised on the command line

238 views
Skip to first unread message

Ray Toal

unread,
May 26, 2016, 10:33:51 PM5/26/16
to Elm Discuss
Hello

I'm doing lots of updating from 0.16 to 0.17 and since Graphics.Element was moved out of core, I figured it was time to ditch ElementRunner and do some nice command line testing. This is great because I have a ton of files with tests in them and would like to just run them all on the command line.

I noticed that we now have elm-community/elm-test instead of deadfoxygrandpa/elm-test.

I went straight to the command line example here: 


This example looked great so I made a file with it and did exactly what it told me to do but I got errors:

$ cat Tests.elm

module Tests exposing (..)


import ElmTest exposing (..)


tests : Test

tests =

    suite "A Test Suite"

        [ test "Addition" (assertEqual (3 + 17) 10)

        , test "String.left" (assertEqual "a" (String.left 1 "abcdefg"))

        , test "This test should fail" (assert False)

        ]


main : Program Never

main =

    runSuite tests

 

$ elm-make Tests.elm --output tests.js

Success! Compiled 10 modules.                                       

elm-make: elm-stuff/build-artifacts/0.17.0/elm-community/elm-test/1.1.0/ElmTest-Runner-Console.elmo: openFile: does not exist (No such file or directory)

 

$ node tests.js

tests.js:3552

});

  ^

SyntaxError: Unexpected end of input

    at Object.exports.runInThisContext (vm.js:53:16)

    at Module._compile (module.js:513:28)

    at Object.Module._extensions..js (module.js:550:10)

    at Module.load (module.js:458:32)

    at tryModuleLoad (module.js:417:12)

    at Function.Module._load (module.js:409:3)

    at Function.Module.runMain (module.js:575:10)

    at startup (node.js:160:18)

    at node.js:449:3


Errors! So I don't have an ElmTest-Runner-Console.elmo and the generated JavaScript is broken.

Has anyone else noticed this? If so, great. If not, I guess I would have to figure out what is going on and do the fix and make the pull request, but am on a bit of a tight schedule and was hoping perhaps this was a known issue with a workaround, OR I'm just all messed up with my Elm configuration.

I am using node 6.2.0, Elm 0.17.0 installed from Homebrew and my elm-package.json contains:

    "exposed-modules": [],

    "dependencies": {

        "elm-community/elm-test": "1.1.0 <= v < 2.0.0",

        "elm-lang/core": "4.0.0 <= v < 5.0.0",

        "elm-lang/html": "1.0.0 <= v < 2.0.0",

        "evancz/elm-http": "3.0.1 <= v < 4.0.0",

        "evancz/elm-markdown": "3.0.0 <= v < 4.0.0"

    },

    "elm-version": "0.17.0 <= v < 0.18.0"



Ray Toal

unread,
May 27, 2016, 12:30:18 AM5/27/16
to Elm Discuss
Well I fixed my problem by completely blowing away the elm-stuff directory.

Also to upgrade to 0.17 it was necessary to import String.

Max Goldstein

unread,
May 27, 2016, 12:49:08 AM5/27/16
to Elm Discuss
Hi Ray, sorry for the trouble, glad you got it sorted out. If you like, you can send a PR to elm-community/elm-test to update the README.

Ray Toal

unread,
May 27, 2016, 1:19:44 AM5/27/16
to Elm Discuss
Thanks for the pointer to that article...Very helpful!

Ray Toal

unread,
May 27, 2016, 1:20:13 AM5/27/16
to Elm Discuss
Also, PR sent.

kgashok

unread,
May 30, 2016, 2:55:33 PM5/30/16
to Elm Discuss
I followed the updated article at https://medium.com/@_rchaves_/testing-in-elm-93ad05ee1832#.u0cv82yl8 - but when I run
node tests.js

I get the following error: 


 onDocument
: F3(on(document)),
                 
^
ReferenceError: document is not defined
    at
/home/ashokb/hero/hello/tests/tests.js:7822:20
    at
Object.<anonymous> (/home/ashokb/hero/hello/tests/tests.js:7826:2)
    at
Object.<anonymous> (/home/ashokb/hero/hello/tests/tests.js:9487:4)
    at
Module._compile (module.js:456:26)
    at
Object.Module._extensions..js (module.js:474:10)
    at
Module.load (module.js:356:32)
    at
Function.Module._load (module.js:312:12)
    at
Function.Module.runMain (module.js:497:10)
    at startup
(node.js:119:16)
    at node
.js:945:3



Jessica Kerr

unread,
Aug 23, 2016, 1:40:15 PM8/23/16
to Elm Discuss
In case someone else finds this by googling like I did --

elm-test wasn't working for me; running `elm-test` worked once, and every time after that I saw an error like
"Cannot find package Mouse" (when the package was installed fine)

It was fixed by updating node.
Reply all
Reply to author
Forward
0 new messages