Elm-test fails to run

Hi, I’m experiencing an issue running elm-test. It fails saying it can’t find node_module/.bin/elm.

I’m using a basic .travis.yml config:

language: elm
elm:
    - "0.19.0"

The error I get is:

Unhandled exception while running the tests: { Error: spawn node_modules/.bin/elm ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
    at onErrorNT (internal/child_process.js:407:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
    at startup (internal/bootstrap/node.js:285:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn node_modules/.bin/elm',
  path: 'node_modules/.bin/elm',
  spawnargs:
   [ 'make',
     '/home/travis/build/chaplean/elm-symfony-bridge/tests/ElmTest.elm',
     '/home/travis/build/chaplean/elm-symfony-bridge/tests/MainTest.elm',
     '/home/travis/build/chaplean/elm-symfony-bridge/tests/Routing/ParserTest.elm',
     '/home/travis/build/chaplean/elm-symfony-bridge/tests/Routing/TranspilerTest.elm',
     '/home/travis/build/chaplean/elm-symfony-bridge/tests/StringUtilTest.elm',
     '/home/travis/build/chaplean/elm-symfony-bridge/tests/Translation/ParserTest.elm',
     '/home/travis/build/chaplean/elm-symfony-bridge/tests/Translation/TranspilerTest.elm',
     '/home/travis/build/chaplean/elm-symfony-bridge/tests/UnindentTest.elm',
     '--output',
     '/dev/null' ] }
The command "elm-format --validate . && elm-test" exited with 1.

There was some discussion about this on the elm slack and apparently not everyone was affected (with the same .travis.yml).

As a workaround I can define the command to run in my package.json and then call it in the .travis.yml.

package.json:

{
  …
  "scripts": {
    "ci-test": "elm-test"
  },
  …
}

.travis.yml:

language: elm
elm:
    - "0.19.0"

script:
  - npm run ci-test

Using that the tests run without any issue.

As the travis log asks for, here are relevant mentions @rtfeldman.

Why is it invoking elm in node_modules/.bin? My quick test shows that it should be in something like /home/travis/.nvm/versions/node/v10.13.0/bin.

https://travis-ci.org/BanzaiMan/travis_production_test/jobs/483768498#L486

I am encoutering the same issue. I also tested if an old build, that previously passed, would break when rerun, and it did break!

My project’s Travis log.

If the previously passing build now fails, it is often due to the changes in underlying dependencies. Examine the logs carefully, and identify what changed.

I made a custom .travis.yml where I used the lates elm-test version and run the same commands. That works.

I didn’t test elm-test@0.19.0-rev4! But I assume that the default language: elm script is somehow broken, or maybe just elm-test@0.19.0-rev4.

I was encoutering the same issue.

My project’s Travis Log.
At this time, I ran shellscript

language: elm
elm-test: 0.19.0
elm-format: 0.8.0
node_js: 'stable'
before_script:
  - chmod +x ./bin/travis-test.sh
script: ./bin/travis-test.sh

I have solved this issue, by I stop using shellscript.
My project’s Travis Log

language: elm
node_js: 'stable'
script:
  - elm-format --validate . && elm-test

Since I just struggled again to figure out what to do:

What solved it for me was to not rely on the global elm installation, but to execute elm-test from a yarn script, such that yarn would resolve the binary:

// package.json
...
"scripts": {
    ...
    "test": "elm-format --validate . && elm-test"
  },
...
// travis.yml
...
script:
  - yarn test