microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.98k stars 29.19k forks source link

`extensionHost` launch config should support `.vscode-test.js` files natively #199211

Closed TylerLeonhardt closed 8 months ago

TylerLeonhardt commented 11 months ago

The new .vscode-test.js format and test runner are awesome, but some folks still like to use the regular ol' extensionHost launch config to run & debug tests.

We should support this new way in the launch config as well so that we don't have to implement our own runner in order to do this.

connor4312 commented 8 months ago

You should be able to reference a test config file using this format in your launch.json:

{
    "type": "extensionHost",
    "request": "launch",
    "name": "My extension tests",
    "testConfiguration": "${workspaceFolder}/.vscode-test.js",
},

The sample works: https://github.com/microsoft/vscode-extension-samples/tree/main/helloworld-test-cli-sample

karthiknadig commented 8 months ago

It does not seem to pick up: image

Version: 1.87.0-insider (system setup) Commit: ee69e2887fbe532588f74ae86560e7fdc1e59550 Date: 2024-02-21T05:47:47.750Z Electron: 27.3.2 ElectronBuildId: 26836302 Chromium: 118.0.5993.159 Node.js: 18.17.1 V8: 11.8.172.18-electron.0 OS: Windows_NT x64 10.0.22621

TylerLeonhardt commented 8 months ago

Not sure if this is a verification found but the args in our mjs are not being applied:

part of mjs:

export default defineConfig({
    files: __dirname + '/dist/test-extension.js',
    version: 'insiders',
    launchArgs: [
        '--disable-extensions',
        '--user-data-dir=' + tempdir,
    ],
    mocha: {
        ui: 'tdd',
        color: true,
        forbidOnly: !!process.env.CI,
        timeout: 5000
    }
});

config:

        {
            "name": "Extension tests",
            "type": "extensionHost",
            "request": "launch",
            "testConfiguration": "${workspaceFolder}/.vscode-test.mjs",
            "sourceMaps": true,
            "smartStep": true,
            "internalConsoleOptions": "openOnSessionStart",
            "outFiles": [
                "${workspaceFolder}/dist/**/*.js",
                "!**/node_modules/**"
            ],
        },

Let me know if you need more details. This is a private repo FYI.

TylerLeonhardt commented 8 months ago

@karthiknadig you need the nightly js debug or wait til tomorrow's insiders