dap-mode icon indicating copy to clipboard operation
dap-mode copied to clipboard

`dap-java--run-unit-test-command` fails in `fish` shell

Open Walheimat opened this issue 2 years ago • 0 comments

I use fish shell and noticed that the dap-java--run-unit-test-command doesn't work because of it.

When I run it in a clean maven project:

mvn -B archetype:generate -DgroupId=com.walheimat.test -DartifactId=wal-test -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4

I get the following error on dap-java-run-test-class:

-*- mode: dap-server-log; default-directory: "~/tests/javas/wal-test/" -*-
Debug Adapter started at Thu Nov 10 20:44:25

java -jar /home/karusster/.emacs.d/eclipse.jdt.ls/test-runner/junit-platform-console-standalone.jar -cp $JUNIT_CLASS_PATH -c com.walheimat.test.AnotherTest
Error parsing command-line arguments: Unmatched arguments from index 2: '/home/karusster/tests/javas/wal-test/target/classes', '/home/karusster/.m2/repository/junit/junit/4.11/junit-4.11.jar', '/home/karusster/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar'

Usage: [1mConsoleLauncher[21m[0m [OPTIONS]
Launches the JUnit Platform for test discovery and execution.
      [[33m@<filename>[39m[0m...]       One or more argument files containing options.

[1mCOMMANDS[21m[0m

  [33m-h[39m[0m, [33m--help[39m[0m                 Display help information.
      [33m--list-engines[39m[0m         List all observable test engines.

[1mSELECTORS[21m[0m

      [33m--scan-classpath, --sc[39m[0m[33man-class-path[39m[0m[=[3mPATH[23m[0m]
                             Scan all directories on the classpath or explicit classpath
                               roots. Without arguments, only directories on the system
                               classpath as well as additional classpath entries supplied via
                               -cp (directories and JAR files) are scanned. Explicit
                               classpath roots that are not on the classpath will be silently
                               ignored. This option can be repeated.
      [33m--scan-modules[39m[0m         EXPERIMENTAL: Scan all resolved modules for test discovery.
  [33m-u[39m[0m, [33m--select-uri[39m[0m=[3mURI[23m[0m       Select a URI for test discovery. This option can be repeated.
  [33m-f[39m[0m, [33m--select-file[39m[0m=[3mFILE[23m[0m     Select a file for test discovery. This option can be repeated.
  [33m-d[39m[0m, [33m--select-directory[39m[0m=[3mDIR[23m[0m Select a directory for test discovery. This option can be
                               repeated.
  [33m-o[39m[0m, [33m--select-module[39m[0m=[3mNAME[23m[0m   EXPERIMENTAL: Select single module for test discovery. This
                               option can be repeated.
  [33m-p[39m[0m, [33m--select-package[39m[0m=[3mPKG[23m[0m   Select a package for test discovery. This option can be repeated.
  [33m-c[39m[0m, [33m--select-class[39m[0m=[3mCLASS[23m[0m   Select a class for test discovery. This option can be repeated.
  [33m-m[39m[0m, [33m--select-method[39m[0m=[3mNAME[23m[0m   Select a method for test discovery. This option can be repeated.
  [33m-r[39m[0m, [33m--select-resource[39m[0m=[3mRESO[23m[0m[3mURCE[23m[0m
                             Select a classpath resource for test discovery. This option can
                               be repeated.
  [33m-i[39m[0m, [33m--select-iteration[39m[0m=[3mTYP[23m[0m[3mE:VALUE[INDEX(..INDEX)?(,INDEX(..INDEX)?)*][23m[0m
                             Select iterations for test discovery (e.g. method:com.acme.
                               Foo#m()[1..2]). This option can be repeated.

[1mFILTERS[21m[0m

  [33m-n[39m[0m, [33m--include-classname[39m[0m=[3mPA[23m[0m[3mTTERN[23m[0m
                             Provide a regular expression to include only classes whose fully
                               qualified names match. To avoid loading classes unnecessarily,
                               the default pattern only includes class names that begin with
                               "Test" or end with "Test" or "Tests". When this option is
                               repeated, all patterns will be combined using OR semantics.
                               Default: ^(Test.*|.+[.$]Test.*|.*Tests?)$
  [33m-N[39m[0m, [33m--exclude-classname[39m[0m=[3mPA[23m[0m[3mTTERN[23m[0m
                             Provide a regular expression to exclude those classes whose
                               fully qualified names match. When this option is repeated, all
                               patterns will be combined using OR semantics.
      [33m--include-package[39m[0m=[3mPKG[23m[0m  Provide a package to be included in the test run. This option
                               can be repeated.
      [33m--exclude-package[39m[0m=[3mPKG[23m[0m  Provide a package to be excluded from the test run. This option
                               can be repeated.
  [33m-t[39m[0m, [33m--include-tag[39m[0m=[3mTAG[23m[0m      Provide a tag or tag expression to include only tests whose tags
                               match. When this option is repeated, all patterns will be
                               combined using OR semantics.
  [33m-T[39m[0m, [33m--exclude-tag[39m[0m=[3mTAG[23m[0m      Provide a tag or tag expression to exclude those tests whose
                               tags match. When this option is repeated, all patterns will be
                               combined using OR semantics.
  [33m-e[39m[0m, [33m--include-engine[39m[0m=[3mID[23m[0m    Provide the ID of an engine to be included in the test run. This
                               option can be repeated.
  [33m-E[39m[0m, [33m--exclude-engine[39m[0m=[3mID[23m[0m    Provide the ID of an engine to be excluded from the test run.
                               This option can be repeated.

[1mRUNTIME CONFIGURATION[21m[0m

      [33m-cp, --classpath, --cl[39m[0m[33mass-path[39m[0m=[3mPATH[23m[0m
                             Provide additional classpath entries -- for example, for adding
                               engines and their dependencies. This option can be repeated.
      [33m--config[39m[0m=[3mKEY=VALUE[23m[0m     Set a configuration parameter for test discovery and execution.
                               This option can be repeated.

[1mREPORTING[21m[0m

      [33m--fail-if-no-tests[39m[0m     Fail and return exit status code 2 if no tests are found.
      [33m--reports-dir[39m[0m=[3mDIR[23m[0m      Enable report output into a specified local directory (will be
                               created if it does not exist).

[1mCONSOLE OUTPUT[21m[0m

      [33m--disable-ansi-colors[39m[0m  Disable ANSI colors in output (not supported by all terminals).
      [33m--color-palette[39m[0m=[3mFILE[23m[0m   Specify a path to a properties file to customize ANSI style of
                               output (not supported by all terminals).
      [33m--single-color[39m[0m         Style test output using only text attributes, no color (not
                               supported by all terminals).
      [33m--disable-banner[39m[0m       Disable print out of the welcome message.
      [33m--details[39m[0m=[3mMODE[23m[0m         Select an output details mode for when tests are executed. Use
                               one of: none, summary, flat, tree, verbose. If 'none' is
                               selected, then only the summary and test failures are shown.
                               Default: tree.
      [33m--details-theme[39m[0m=[3mTHEME[23m[0m  Select an output details tree theme for when tests are executed.
                               Use one of: ascii, unicode. Default is detected based on
                               default character encoding.

For more information, please refer to the JUnit User Guide at
[4mhttps://junit.org/junit5/docs/current/user-guide/[24m[0m

Debug Adapter exited abnormally with code 255 at Thu Nov 10 20:44:26

I guess the problem is the way the env is set? In any case, works fine when just forcing shell-file-name to bash but maybe there's some way to have this work for fish users as well or give a warning if your shell-file-name is fish?

Thanks!

Walheimat avatar Nov 10 '22 19:11 Walheimat