Invalid elm.json when installing ktonon/elm-test-extra

Hi,

I have been missing ktonon/elm-serverless which is not yet ported to 0.19. So I have taken the half-finished PR for that and kept working on it. Github repo is here (elm-0.19) branch:

Whilst trying to get the elm tests working, I need to install ktonon/elm-test-extra. If I do this with elm-test install or with elm-json, I don’t seem to get a valid elm.json.

> elm-json install --test ktonon/elm-test-extra
....
> 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-run
ner/issues

Same with elm-test install. Both these commands just add "ktonon/elm-test-extra": "2.0.1 <= v < 3.0.0" to the “test-dependencies” section. The full elm.json files for elm-serverless and elm-test-extra are pasted below.

II wanted to use this tool Dependencies analyzer for application elm.json, to tell me what is wrong with the elm.json but it only works for applications.

Any idea how to diagnose the issue and get a correct elm.json file?

== elm.json for elm-serverless

{
    "type": "package",
    "name": "ktonon/elm-serverless",
    "summary": "Deploy an elm worker to AWS Lambda using serverless",
    "license": "MIT",
    "version": "4.0.1",
    "exposed-modules": [
        "Serverless",
        "Serverless.Conn",
        "Serverless.Conn.Request",
        "Serverless.Conn.Response",
        "Serverless.Plug"
    ],
    "elm-version": "0.19.0 <= v < 0.20.0",
    "dependencies": {
        "NoRedInk/elm-json-decode-pipeline": "1.0.0 <= v < 2.0.0",
        "elm/core": "1.0.0 <= v < 2.0.0",
        "elm/http": "1.0.0 <= v < 2.0.0",
        "elm/json": "1.0.0 <= v < 2.0.0"
    },
    "test-dependencies": {
        "elm/regex": "1.0.0 <= v < 2.0.0",
        "elm/url": "1.0.0 <= v < 2.0.0",
        "ktonon/elm-test-extra": "2.0.1 <= v < 3.0.0"
    }
}

== elm.json for elm-test-extra

{
    "type": "package",
    "name": "ktonon/elm-test-extra",
    "summary": "Extra expectations, fuzzers, testers and describers",
    "license": "MIT",
    "version": "2.0.1",
    "exposed-modules": [
        "Expect.Extra",
        "Fuzz.Extra",
        "Test.Extra"
    ],
    "elm-version": "0.19.0 <= v < 0.20.0",
    "dependencies": {
        "elm/core": "1.0.2 <= v < 2.0.0",
        "elm/json": "1.1.2 <= v < 2.0.0",
        "elm/random": "1.0.0 <= v < 2.0.0",
        "elm/regex": "1.0.0 <= v < 2.0.0",
        "elm-explorations/test": "1.2.0 <= v < 2.0.0"
    },
    "test-dependencies": {}
}

Ok, think I figured out how to diagnose it.

elm-test outputs an elm.json for an application to lm-stuff/generated-code/elm-explorations/test/elm.json which can be pasted into Elm Dependencies Analyzer.

This reveals that:

Selected versions have dependency conflicts:

  • elm/core 1.0.0
    • 1.0.2 <= v < 2.0.0 needed by ktonon/elm-test-extra 2.0.1
  • elm/json 1.0.0
    • 1.1.2 <= v < 2.0.0 needed by ktonon/elm-test-extra 2.0.1

So I will try tightening up the version ranges to use these versions. Not sure why the version ranges don’t get solved correctly.

Yes, I’ve been running into this too – it appears to be a bug in elm-test’s node test runner that always adds elm/json 1.0.0 instead of the minimum version of elm/json required by the app.

(I’m not sure if there’s a github issue logged for this yet.)

The workaround (though fixing elm-test might be faster) is to have ktonon/elm-test-extra expand it’s allowed range for elm/json to include 1.0.0 (assuming it doesn’t depend on Json.Decode.oneOrMore, which is the only difference between 1.0 and 1.1).

I already had elm/json 1.0.0 in the elm.json (and elm/core 1.0.0):

“elm/core”: “1.0.0 <= v < 2.0.0”,
“elm/json”: “1.0.0 <= v < 2.0.0”

I think the bug is that when elm-test generates its application style elm.json it fails to run a version solver on all the dependencies - does it even do this? or it just takes lower bounds direct or something? The solution was simply to manually edit core to 1.0.2 and json to 1.1.2 in my elm.json.

I’ll paste my failing elm.json into a github issue against elm-test.

1 Like

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