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

VSCode mix test task fails on fresh phx.new application #55

Closed
awwong1 opened this issue Mar 20, 2020 · 3 comments
Closed

VSCode mix test task fails on fresh phx.new application #55

awwong1 opened this issue Mar 20, 2020 · 3 comments

Comments

@awwong1
Copy link

awwong1 commented Mar 20, 2020

Problem

The vscode-elixir-ls plugin debugger fails on a new phoenix application mix test task.

Reproduce

  1. Create a new phoenix application
mix phx.new hello # accept when prompted
cd hello
  1. Verify that mix test works in terminal
 mix test

# 13:12:05.053 [info]  Already up
# ...

# Finished in 0.07 seconds
# 3 tests, 0 failures

# Randomized with seed 130324
  1. Verify that mix_test task fails in VS Code
    • .vscode/launch.json
{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "mix_task",
            "name": "mix (Default task)",
            "request": "launch",
            "projectDir": "${workspaceRoot}"
        },
        {
            "type": "mix_task",
            "name": "mix test",
            "request": "launch",
            "task": "test",
            "taskArgs": [
                "--trace"
            ],
            "startApps": true,
            "projectDir": "${workspaceRoot}",
            "requireFiles": [
                "test/**/test_helper.exs",
                "test/**/*_test.exs"
            ]
        }
    ]
}
Started ElixirLS Fork debugger v0.3.1
Elixir version: "1.10.2 (compiled with Erlang/OTP 22)"
Erlang version: "22"
** Invalid beam file or no abstract code: 'Elixir.HelloWeb.PageControllerTest'
** Invalid beam file or no abstract code: 'Elixir.HelloWeb.ErrorViewTest'
** Invalid beam file or no abstract code: 'Elixir.HelloWeb.LayoutViewTest'
** Invalid beam file or no abstract code: 'Elixir.HelloWeb.PageViewTest'
(Debugger) Task failed because an exception was raised:
    ** (UndefinedFunctionError) function HelloWeb.PageViewTest.__ex_unit__/0 is undefined (module HelloWeb.PageViewTest is not available)
        HelloWeb.PageViewTest.__ex_unit__()
        (ex_unit 1.10.2) lib/ex_unit/runner.ex:118: ExUnit.Runner.run_module/2

Expected Behaviour

I expect the tests to execute in the same way as in the external terminal.

When I comment out all of the requireFiles, the task runs but I am unable to set breakpoints.

Environment

elixir -v  # Elixir version
# Erlang/OTP 22 [erts-10.6] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]
# Elixir 1.10.2 (compiled with Erlang/OTP 22)

mix phx # Phoenix version
# Phoenix v1.4.16

code -v # Microsoft Visual Studio Code version
# 1.43.0
# 78a4c91400152c0f27ba4d363eb56d2835f9903a
# x64

uname -srvmo # machine information
# Linux 4.19.0-8-amd64 #1 SMP Debian 4.19.98-1 (2020-01-26) x86_64 GNU/Linux
Name: ElixirLS Fork: Elixir support and debugger
Id: elixir-lsp.elixir-ls
Description: Elixir support with debugger, autocomplete, and more. Powered by ElixirLS.
Version: 0.3.1
Publisher: elixir-lsp
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=elixir-lsp.elixir-ls
@awwong1 awwong1 changed the title VSCode mix test task fails on fresh Phx.new application VSCode mix test task fails on fresh phx.new application Mar 20, 2020
@bpiepiora
Copy link

I have the same issue with a normal 'mix new' application

Error output

Started ElixirLS Fork debugger v0.3.2
Elixir version: "1.10.2 (compiled with Erlang/OTP 22)"
Erlang version: "22"
** Invalid beam file or no abstract code: 'Elixir.BusinessRulesTest'
** Invalid beam file or no abstract code: 'Elixir.BusinessRulesTest'
(Debugger) Task failed because an exception was raised:
    ** (UndefinedFunctionError) function BusinessRulesTest.__ex_unit__/0 is undefined (module BusinessRulesTest is not available)
        BusinessRulesTest.__ex_unit__()
        (ex_unit 1.10.2) lib/ex_unit/runner.ex:118: ExUnit.Runner.run_module/2

22:22:36.444 [error] Process #PID<0.173.0> raised an exception
** (UndefinedFunctionError) function BusinessRulesTest.__ex_unit__/0 is undefined (module BusinessRulesTest is not available)
    BusinessRulesTest.__ex_unit__()
    (ex_unit 1.10.2) lib/ex_unit/runner.ex:118: ExUnit.Runner.run_module/2

Environment

elixir -v
# Erlang/OTP 22 [erts-10.7] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]
# Elixir 1.10.2 (compiled with Erlang/OTP 22)

code -v
# 1.43.2
# 0ba0ca52957102ca3527cf479571617f0de6ed50
# x64

uname --all
# Linux 5.5.11-200.fc31.x86_64 #1 SMP Mon Mar 23 17:32:43 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

@axelson
Copy link
Member

axelson commented Mar 28, 2020

I believe that we have to wait for Elixir 1.10.3 to be released so that it can contain this fix: elixir-lang/elixir#9864

As a workaround you can downgrade your project to 1.9.x.

@awwong1
Copy link
Author

awwong1 commented Mar 28, 2020

Sure, I will wait until 1.10.3 is released and then reproduce these steps. If they're still present, I will reopen this issue. Thanks!

@awwong1 awwong1 closed this as completed Mar 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants