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

Multi-root Workspaces issue #40

Open
fuchse-ego opened this issue Oct 12, 2022 · 7 comments
Open

Multi-root Workspaces issue #40

fuchse-ego opened this issue Oct 12, 2022 · 7 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@fuchse-ego
Copy link

Hi,

I'm using this extension in a single folder workspace and it's great!

However I experimented with the new Multi-root Workspaces and found that the test are not listed correctly.
The tests will show up as "Main Suite" with no child nodes.

Steps to reproduce:

  1. Open folder with working tests.
  2. Add workspace folder (File -> Add folder to workspace)
  3. The tests are no longer available.

Unfortunately. I'm no JavaScript/TypeScript guy, so I cannot help you out with a PR :(

@bneumann
Copy link
Owner

Hi,

thanks for letting me know. I am sorry that I cannot investigate at the moment. I will look into it as soon as possible.

@bneumann bneumann added enhancement New feature or request good first issue Good for newcomers labels Oct 20, 2022
@nische
Copy link

nische commented Dec 12, 2022

@fuchse-ego Did you make it work with multiroot?

@nische
Copy link

nische commented Dec 13, 2022

Maybe somebody need this information:

After I specified the settings in the workspace settings, the testexplorer find the tests but add one "Main Suite" for each folder in Workspace.
For me this will work at the Moment

Settings:

{
	"folders": [
		{
			"path": "CMake",
			"name": "Testrunner (local)"
		},
		{
			"path": "Core"
		},
		{
			"path": "Tests"
		}
	],
	"settings": {
		"todo-tree.tree.scanMode": "workspace only",
		"cmake.autoSelectActiveFolder": false,
		"cpputestTestAdapter.logpanel": true,
		"cpputestTestAdapter.testExecutable": "${workspaceFolder}/build/testrunner.exe",
		"cpputestTestAdapter.testExecutablePath": "${workspaceFolder}/build/",
		"testExplorer.hideWhen": "noAdapters",
		"testExplorer.useNativeTesting": false,
	}
}

@fuchse-ego
Copy link
Author

fuchse-ego commented Jan 3, 2023

Hi @nische,
thanks for this example. I also got it to work. However, as you mentioned, it duplicates all testes in as many "Main Suits" as you have workspace folders:
image

Seems the bug here is that the test adapter only finds the test if specified in the workspace settings.
It does not respect the individual .vscode/settings.json files in the workspace folders and the settings there.

Edit:
I noticed that it only works, if the UnitTest folders is the first one in your workspace configuration.
I'm no Java/TypeScript guy, but this line (main.ts#L8) seems suspicious:

	const workspaceFolder = (vscode.workspace.workspaceFolders || [])[0];`

@bneumann
Copy link
Owner

Nice find. Yes that line is very much suspicious and now that I read I can remember that I had some issues with that as well. From the back of my head I'd say it was due to the old extension. But since I am using the "new" test api anyways I think it is fixable

@bneumann
Copy link
Owner

I am currently over it and I am actually confused how you would set the test executable for multiple workspace because the setting itself only exists once. Best approach would be to add them all as a list and let the extension figure out which one exists. But then again, if you use {workspace} which one is it?

@bneumann
Copy link
Owner

To answer my own question:
VSCode got you all covered, there is a folder setting as well. I will use that to let you configure the specific workspace testrunners:

grafik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants