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

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

Open
Jason3S opened this issue Sep 8, 2023 · 1 comment
Open

Comments

@Jason3S
Copy link

Jason3S commented Sep 8, 2023

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

@selfint
Copy link

selfint commented Dec 22, 2023

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

I found that deleting the .vscode-test/user-data directory is enough. That way vscode-test doesn't need to download VS Code again.

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