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

Cannot run tests when setting "java.import.maven.disableTestClasspathFlag": "true" #1690

Open
PunchedChimera opened this issue May 10, 2024 · 4 comments

Comments

@PunchedChimera
Copy link

PunchedChimera commented May 10, 2024

Hi, when setting the property "java.import.maven.disableTestClasspathFlag": "true" in .vscode/settings.xml the test extension seems to break.
No tests are discoverable in the Test Explorer and the run icons in the gutter disappear. Tested on multiple systems and on a fresh/clean install of VsCode. This is on Window, both natively and via WSL2.

"java.import.maven.disableTestClasspathFlag": "true" (Not working)

image

"java.import.maven.disableTestClasspathFlag": "false" (Works as expected)

image

@jdneo
Copy link
Member

jdneo commented May 11, 2024

The exxtension uses the test flag in the classpath to determine where the test source root is.

If that flag is disabled. It could not detect the test location. May I ask why would you like to turn it off?

@PunchedChimera
Copy link
Author

I have a project that contains test-jars that need to be used in compile scope. Without setting that flag, any classes in these test-jars are not on the classpath and result in multiple class not found/ un-resolved compilation errors when attempting to run tests via the test-runner.
These issues are not present when compiling/ running the tests through command line (maven in my case).
I have created a simple project that demonstrates this: https://github.com/PunchedChimera/demo-test-jar-deps

@jdneo
Copy link
Member

jdneo commented May 13, 2024

Thank you for the attached project.

So far, the extension only detect the test root by searching the test classpath flag of the project. I'm afraid that AFAIK, there is no workaround right now.

To resolve the issue, maybe we can remove this restriction and directly search the test cases by those annotations. But I'm not sure the impact on the perf for this approach.

@jdneo
Copy link
Member

jdneo commented May 27, 2024

related with #464

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

2 participants