microsoft / vscode-extension-test-runner

Runs tests in the UI for VS Code extensions
MIT License
9 stars 4 forks source link

Failure of VS Code download and unzip due to `asar` file #9

Closed kazarmy closed 11 months ago

kazarmy commented 11 months ago

vscode-test doesn't download and unzip latest VS Code successfully when trying to run tests. Log follows (with extension name snipped out):

>  vscode-test --label 0 --reporter <snip>\node_modules\@vscode\test-cli\out\fullJsonStreamReporter.cjs --run <snip>\out\test\extension.test.js
Downloading VS Code 1.85.0 from https://update.code.visualstudio.com/1.85.0/win32-x64-archive/stable
Downloading VS Code (131526343B)
Downloading VS Code [==============================] 100%Error downloading, retrying (attempt 1 of 3): Invalid package <snip>\.vscode-test\vscode-win32-x64-archive-1.85.0\resources\app\node_modules.asar
Downloading VS Code 1.85.0 from https://update.code.visualstudio.com/1.85.0/win32-x64-archive/stable
Downloading VS Code (131526343B)
Downloading VS Code [==============================] 100%Error downloading, retrying (attempt 3 of 3): Invalid package <snip>\.vscode-test\vscode-win32-x64-archive-1.85.0\resources\app\node_modules.asar
Downloading VS Code 1.85.0 from https://update.code.visualstudio.com/1.85.0/win32-x64-archive/stable
Downloading VS Code (131526343B)
Error: Invalid package <snip>\.vscode-test\vscode-win32-x64-archive-1.85.0\resources\app\node_modules.asar
    at createError (node:electron/js2c/asar_bundle:2:1608)
    at t.<computed> [as open] (node:electron/js2c/asar_bundle:2:2442)
    at WriteStream._construct (node:internal/fs/streams:69:17)
    at constructNT (node:internal/streams/destroy:275:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
Error: Failed to download and unzip VS Code 1.85.0
    at download (<snip>\node_modules\@vscode\test-electron\out\download.js:369:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.downloadAndUnzipVSCode (<snip>\node_modules\@vscode\test-electron\out\download.js:383:12)
    at async Module.runTests (<snip>\node_modules\@vscode\test-electron\out\runTest.js:19:40)
    at async runConfigs (file:///<snip>/node_modules/@vscode/test-cli/out/bin.mjs:336:30)
    at async main (file:///<snip>/node_modules/@vscode/test-cli/out/bin.mjs:223:20)
Downloading VS Code [==============================] 100%
Error: Test process exited with code 1

Problem probably has something to do with the issue mentioned at https://stackoverflow.com/questions/43645745/electron-invalid-package-on-unzip. Wasn't expecting problems this early in the extension creation process, but then noticed that the Extension Test Runner extension is very new (as in first release being last October).

kazarmy commented 11 months ago

Apparently one can just download the test VS Code using Node and

import { downloadAndUnzipVSCode } from '@vscode/test-electron';
await downloadAndUnzipVSCode('stable');

and then everything works as expected, so closing this.