Home > Net >  in vscode for mix unit test, how to use `--only` parameter?
in vscode for mix unit test, how to use `--only` parameter?

Time:08-11

The purpose is to debug only one unit test in the exs file, therefore it is necessary to ignore other unit tests in the same exs file.

My previous solution is comment out the other unit test, but the bad side of this solution is I can't find other unit tests easily through vscode's outline view as follows:

enter image description here

From the enter image description here

enter image description here

Remember to keep good posture and stay hydrated!
helloworld
(Debugger) Task failed because an exception was raised:
    ** (Mix.Error) Could not invoke task "test": 1 error found!
--trace --only :external : Unknown option
        (mix 1.13.4) lib/mix.ex:515: Mix.raise/2
        (elixir_ls_debugger 0.10.0) lib/debugger/server.ex:1119: ElixirLS.Debugger.Server.launch_task/2

Then I changed launch.json to "--trace --only :external", similar error message as follows:

(Debugger) Task failed because an exception was raised:
    ** (Mix.Error) Could not invoke task "test": 1 error found!
--trace --only :external : Unknown option
        (mix 1.13.4) lib/mix.ex:515: Mix.raise/2
        (elixir_ls_debugger 0.10.0) lib/debugger/server.ex:1119: ElixirLS.Debugger.Server.launch_task/2

CodePudding user response:

I use a plugin called Commands for Elixir Test

CodePudding user response:

It is caused by syntax problem. Every paremeter should be one element as follows:

    "taskArgs": [
        "--trace", "--warnings-as-errors", "--only", "external"
    ],

enter image description here

  • Related