Skip to content

Fails to run if cached: Error IPC handle is longer than 103 chars. #232

@Jason3S

Description

@Jason3S

Running the test locally on a non-cached instance of VS Code works the first time, but fails if it has been cached.

Note:
It looks like runTests is making a "copy" of the download in $(PWD)/.vscode-test even though I have already downloaded it to a shorter path.

Sample code:

        // try and have a short path to prevent socket errors.
        const cachePath = path.join(extensionDevelopmentPath, cacheDirName);
        const vscodeExecutablePath = await downloadAndUnzipVSCode({ cachePath });
        const options = { vscodeExecutablePath, extensionDevelopmentPath, extensionTestsPath, launchArgs };

        // Note: `.vscode-test` does NOT exist
        console.error('dir before: %o', await fs.readdir('.'));
        await runTests(options);
        // Note: `.vscode-test` does NOW exist
        console.error('dir after: %o', await fs.readdir('.'));

In my case:

  • extensionDevelopmentPath is /Users/jason/projects/vscode-spell-checker
  • Integration tests are run from: /Users/jason/projects/vscode-spell-checker/packages/_integrationTests
Error Log:
Found existing install in /Users/jason/projects/vscode-spell-checker/packages/_integrationTests/.vscode-test/vscode-darwin-1.82.0. Skipping download
WARNING: IPC handle "/Users/jason/projects/vscode-spell-checker/packages/_integrationTests/.vscode-test/user-data/1.82-main.sock" is longer than 103 chars, try a shorter --user-data-dir
[main 2023-09-08T09:20:14.043Z] Could not delete obsolete instance handle Error: ENOENT: no such file or directory, unlink '/Users/jason/projects/vscode-spell-checker/packages/_integrationTests/.vscode-test/user-data/1.82-main.sock'
    at unlinkSync (node:original-fs:1829:3)
    at Ee.e (/Users/jason/projects/vscode-spell-checker/packages/_integrationTests/.vscode-test/vscode-darwin-1.82.0/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:91:3946)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /Users/jason/projects/vscode-spell-checker/packages/_integrationTests/.vscode-test/vscode-darwin-1.82.0/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:91:1222
    at async Ee.a (/Users/jason/projects/vscode-spell-checker/packages/_integrationTests/.vscode-test/vscode-darwin-1.82.0/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:91:1108) {
  errno: -2,
  syscall: 'unlink',
  code: 'ENOENT',
  path: '/Users/jason/projects/vscode-spell-checker/packages/_integrationTests/.vscode-test/user-data/1.82-main.sock'
}
[main 2023-09-08T09:20:14.045Z] Error: ENOENT: no such file or directory, unlink '/Users/jason/projects/vscode-spell-checker/packages/_integrationTests/.vscode-test/user-data/1.82-main.sock'
    at unlinkSync (node:original-fs:1829:3)
    at Ee.e (/Users/jason/projects/vscode-spell-checker/packages/_integrationTests/.vscode-test/vscode-darwin-1.82.0/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:91:3946)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /Users/jason/projects/vscode-spell-checker/packages/_integrationTests/.vscode-test/vscode-darwin-1.82.0/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:91:1222
    at async Ee.a (/Users/jason/projects/vscode-spell-checker/packages/_integrationTests/.vscode-test/vscode-darwin-1.82.0/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:91:1108)
Exit code:   1
Failed
Failed to run tests
About VS Code
Version: 1.82.0 (Universal)
Commit: 8b617bd08fd9e3fc94d14adb8d358b56e3f72314
Date: 2023-09-06T22:09:41.364Z
Electron: 25.8.0
ElectronBuildId: 23503258
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin x64 22.6.0

Workaround

The workaround is to delete $(PWD)/.vscode-test before running the tests:

        // Delete `.vscode-test` to prevent socket issues
        await fs.rm('.vscode-test', { recursive: true, force: true });

        const cachePath = path.join(extensionDevelopmentPath, cacheDirName);
        const vscodeExecutablePath = await downloadAndUnzipVSCode({ cachePath });
        const options = { vscodeExecutablePath, extensionDevelopmentPath, extensionTestsPath, launchArgs };
        await runTests(options);

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions