microsoft / vscode-test-cli

Command-line runner for VS Code tests
MIT License
19 stars 7 forks source link

installExtensions has no effect when running in WSL #48

Open r9dtech opened 2 months ago

r9dtech commented 2 months ago

I am writing an extension test suite which requires the python extension to be installed.

I have set installExtensions: ['ms-python.vscode-pylance', 'ms-python.vscode-pylance', 'ms-python.python'] in .vscode-test.mjs, but they do not get installed.

My setup is to run VSCode on windows and connect to my ubuntu WSL install. I am also using a dev container (which is running as the root user inside a rootless docker). I suspect that this issue has more to do with WSL than the dev container, but it could be either or both.

If I edit the desktop.mjs from @vscode/test-cli to add more logging, I can see that it runs the following:

/workspaces/myplugin/.vscode-test/vscode-linux-x64-1.90.1/bin/code --extensions-dir=/workspaces/myplugin/.vscode-test/extensions --user-data-dir=/workspaces/myplugin/.vscode-test/user-data --install-extension ms-python.vscode-pylance --install-extension ms-python.python
Ignoring option 'extensions-dir': not supported for code.
Ignoring option 'user-data-dir': not supported for code.
Installing extensions on Dev Container: Devcontainer @ rootless...
Extension 'ms-python.vscode-pylance' v2024.6.1 is already installed. Use '--force' option to update to latest version or provide '@<version>' to install a specific version, for example: 'ms-python.vscode-pylance@1.2.3'.
Extension 'ms-python.python' v2024.8.1 is already installed. Use '--force' option to update to latest version or provide '@<version>' to install a specific version, for example: 'ms-python.python@1.2.3'.

The command exits with code 0, so the output is never shown.

I have worked around it by adding the following code .vscode-test.mjs:

import { env } from 'process';
delete env['VSCODE_IPC_HOOK_CLI'];
env['DONT_PROMPT_WSL_INSTALL'] = 'TRUE';

After which the plugins get installed correctly, but it seems to me that this should work without needing to fiddle with env vars.