Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Received invalid JSON from test interface search #258

Closed
pdamoc opened this issue Jun 6, 2018 · 7 comments
Closed

Received invalid JSON from test interface search #258

pdamoc opened this issue Jun 6, 2018 · 7 comments
Labels

Comments

@pdamoc
Copy link

pdamoc commented Jun 6, 2018

Steps to reproduce with the 0.19.0-beta2 installed:

  • run elm-test inside the example-package, see tests succeed.
  • move one of the files outside from tests
  • run elm-test again

I see:

Received invalid JSON from test interface search: SyntaxError: Unexpected token in JSON at position 0

Deleting elm-stuff and running again elm-test will work (the tests will run and display the result).

@avh4
Copy link
Collaborator

avh4 commented Jun 6, 2018

When the error occurs, can you try running `pwd`/node_modules/.bin/elmi-to-json (or .bin/elmi-to-json relative to wherever elm-test is installed) from the ./elm-stuff/generated/elm-explorations/test folder and post the output?

@pdamoc
Copy link
Author

pdamoc commented Jun 6, 2018

elmi-to-json failed for:
all

I didn't find a module for the interface /Users/petre/Downloads/node-test-runner-av-0.19/example-package/elm-stuff/generated-code/elm-explorations/test/elm-stuff/0.19.0/TestsPassing.elmi.

TestsPassing.elm is the file I took out of the tests folder.

@stil4m
Copy link

stil4m commented Aug 26, 2018

I ran in the same issue @pdamoc originally reports (Received invalid JSON from test interface search: SyntaxError: Unexpected token in JSON at position 0).

My problem related to a test module name that did not correspond with the file name. Renaming the module name to match the file name did not solve the issue immediately. I had to remove the elm-stuff in the test folder as well.

@zwilias
Copy link
Collaborator

zwilias commented Aug 26, 2018

I think #270 should resolve these issues: rather than erroring out when an elmi file is found with no matching module, it would end up being ignored. (Due to stoeffel/elmi-to-json#16)

@mgold
Copy link
Collaborator

mgold commented Aug 30, 2018

I got this error in beta 4, and got a compiler error in beta 5. As mentioned, removing elm-stuff fixes the issue.

Transcript for reference.

$ elm-test
Success!                                                             
Received invalid JSON from test interface search: SyntaxError: Unexpected token in JSON at position 0
$ npm install -g elm-test@beta
[ elided ]
$ elm-test --version
0.19.0-beta5
$ elm-test
Success!                                                             
Detected errors in 1 module.                                         
-- NAMING ERROR - /path/to/repo/elm-stuff/generated-code/elm-explorations/test/src/Test/Generated/Main2771416524.elm

I cannot find a `Test.Runner.Node.run` variable:

15|         |> Test.Runner.Node.run { runs = Nothing, report = (ConsoleReport UseColor), seed = 367817776595062, processes = 12, paths = []}
               ^^^^^^^^^^^^^^^^^^^^
The `Test.Runner.Node` module does not expose a `run` variable. These names seem
close though:

    Test.Runner.Node.runWithOptions
    List.intersperse
    Json.Encode.int
    Json.Encode.null

Hint: Read <https://elm-lang.org/0.19.0/imports> to see how `import`
declarations work in Elm.
Compilation failed for /path/to/repo/elm-stuff/generated-code/elm-explorations/test/src/Test/Generated/Main2771416524.elm
$ rm -rf elm-stuff/
$ elm-test --watch
Success! Compiled 2 modules.                                         
Running in watch mode
Success! Compiled 15 modules.                                        

elm-test 0.19.0-beta5
---------------------

Running 3 tests. To reproduce these results, run: elm-test --fuzz 100 --seed 288202845242859


TEST RUN PASSED

Duration: 148 ms
Passed:   3
Failed:   0

Watching for changes...

@michaeljones
Copy link

I'm seeing this semi-regularly on our CI set up. I can't reproduce it reliably locally. I would welcome any information on how to go about investigating it. I guess I'm actually seeing a slight variant:

Received invalid JSON from test interface search: SyntaxError: Unexpected end of JSON input

@lydell
Copy link
Collaborator

lydell commented Nov 5, 2020

We got rid of elmi-to-json in #442 so this particular error should not happen anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants