elm-github-install icon indicating copy to clipboard operation
elm-github-install copied to clipboard

Trouble using with elm-test

Open dustinfarris opened this issue 8 years ago • 9 comments
trafficstars

I get this output:

$ elm-test

Error: Your .elm/packages/ directory may be corrupted. I was led to believe that
saschatimme/elm-phoenix existed, but I could not find anything when I went to
look up the published versions of this package.

I tried running elm-github-install from within my tests directory (using its own elm-package.json) but that didn't help.

dustinfarris avatar Sep 29 '17 08:09 dustinfarris

I need some information :) both elm-package.jsons and the directory tree of both elm-stuff (tree elm-stuff -L 2) for starters.

gdotdesign avatar Sep 29 '17 09:09 gdotdesign

Ok. For the record I can still run elm-test, it's just giving me this output — not sure if it will bite me or not — I'm just getting started writing tests.

Here's the info you asked for:

https://gist.github.com/dustinfarris/28f138f4b64b522147d881c027a746bc

dustinfarris avatar Sep 29 '17 09:09 dustinfarris

Thanks.

For the record I can still run elm-test

You mean it actually runs the tests and this is some extra output with them?

gdotdesign avatar Sep 29 '17 10:09 gdotdesign

Right, sorry if that wasn't clear. No emergency, just seeing this output every time I run elm-test.

dustinfarris avatar Sep 29 '17 10:09 dustinfarris

@dustinfarris, @gdotdesign : Well, this problem was a show-stopper for me, my temporary solution is this: (see "tachyons-elm" in both files below)

File /elm-package.json:

{
  "version": "1.0.0",
  "summary": "helpful summary of your project, less than 80 characters",
  "repository": "https://github.com/user/project.git",
  "license": "BSD3",
  "native-modules": true,
  "source-directories": ["src"],
  "exposed-modules": [],
  "dependencies": {
    "gdotdesign/elm-spec": "1.0.0 <= v < 2.0.0",
    "MartinKavik/tachyons-elm": "2.1.0 <= v < 3.0.0",
    "elm-lang/core": "5.0.0 <= v < 6.0.0",
    "elm-lang/html": "2.0.0 <= v < 3.0.0",
    "jamesmacaulay/elm-graphql": "1.0.0 <= v < 2.0.0"
  },
  "dependency-sources": {
    "MartinKavik/tachyons-elm": {
      "url": "https://github.com/MartinKavik/tachyons-elm",
      "ref": "6-fix-selector-filter"
    }
  },
  "elm-version": "0.18.0 <= v < 0.19.0"
}

File /tests/elm-package.json:

{
  "version": "1.0.0",
  "summary": "Test Suites",
  "repository": "https://github.com/user/project.git",
  "license": "BSD3",
  "native-modules": true,
  "source-directories": [
    "..\\src",
    ".",
    "..\\elm-stuff\\packages\\MartinKavik\\tachyons-elm\\2.1.0"
  ],
  "exposed-modules": [],
  "dependencies": {
    "eeue56/elm-html-test": "5.1.1 <= v < 6.0.0",
    "elm-community/elm-test": "4.0.0 <= v < 5.0.0",
    "elm-lang/core": "5.0.0 <= v < 6.0.0",
    "elm-lang/html": "2.0.0 <= v < 3.0.0",
    "jamesmacaulay/elm-graphql": "1.0.0 <= v < 2.0.0"
  },
  "elm-version": "0.18.0 <= v < 0.19.0"
}

MartinKavik avatar Oct 02 '17 23:10 MartinKavik

@MartinKavik The dependencies in test/elm-package.json needs to include all dependencies of the parent elm-package.json (4. point of https://github.com/elm-community/elm-test#running-tests-locally) and probably you need to install the dependencies with elm-github-install after that in the test directory.

@dustinfarris I think the node-test-runner tries to install packages on every run and shows the message because it cannot complete it.

I think all I can do is to mention this in the Readme.

gdotdesign avatar Oct 03 '17 04:10 gdotdesign

I'd like to clarify that for this to work, you need to be on node-test-runner 0.18.9 or newer which doesn't stop when it can't install dependencies.

mingan avatar Oct 31 '17 07:10 mingan

There is a pretty nasty hack you can use to get this working.

package.json

{
  "scripts": {
    "test": "rsync -r tests/elm-stuff elm-stuff/generated-code/elm-community/elm-test/elm-stuff && elm-test"
}

then to deal with the call to elm-package install -y add a blank file called elm-package to the start of your PATH var.

This does mean that elm-package isn't available for normal use but if you use elm-install everywhere then this shouldn't be an issue.

opsb avatar Jul 12 '18 08:07 opsb

For anyone else having trouble with this, note that no released version of elm-test actually has the --skip-installed flag - it was added, but then removed again.

I found I was able to get my setup working as follows:

Install commit b671657b00cf2eae6771078a6133753caa15b17b of elm-test (i.e. https://github.com/rtfeldman/node-test-runner/pull/200/commits/b671657b00cf2eae6771078a6133753caa15b17b ), which can be done like this:

npm install 'rtfeldman/node-test-runner#b671657b00cf2eae6771078a6133753caa15b17b' -g

Then, in the 'tests' directory, after having set up the elm-package.json with dependencies and dependency_sources as per your main elm-package.json, do:

elm-install

Then in the main directory (that contains tests/):

elm-test --skip-install

spookylukey avatar Mar 12 '19 08:03 spookylukey