Open Jason3S opened 1 year ago
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.
I was still having the Socket issue when try to run the insiders build locally.
To prevent runTest
from magically coming up a long directory path, it is possible to pass the --user-data-dir
argument:
async function run(version: undefined | 'stable' | 'insiders' | string, extensionDevelopmentPath: string) {
// Delete `.vscode-test` to prevent socket issues
await fs.rm(cacheDirName, { recursive: true, force: true });
await fs.rm(path.resolve(root, cacheDirName), { recursive: true, force: true });
// try and have a short path to prevent socket errors.
const cachePath = path.join(root, cacheDirName);
// The path to the extension test runner script
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(__dirname, './index.cjs');
const fileToOpen = path.relative(process.cwd(), __filename);
const launchArgs: string[] = [
'--disable-extensions',
fileToOpen,
`--extensions-dir=${path.join(cachePath, `${version}`, 'extensions')}`,
`--user-data-dir=${path.join(cachePath, `${version}`, 'user-data')}`,
];
const vscodeExecutablePath = await downloadAndUnzipVSCode({ cachePath, version });
const options = { vscodeExecutablePath, extensionDevelopmentPath, extensionTestsPath, launchArgs };
await runTests(options);
}
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:
In my case:
extensionDevelopmentPath
is/Users/jason/projects/vscode-spell-checker
/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:Related Issues