redhat-developer / vscode-extension-tester

ExTester: Your Essential UI Testing Companion for Visual Studio Code Extensions! Seamlessly execute UI tests with Selenium WebDriver, ensuring robustness and reliability in your extension development journey. Simplify UI testing for your VS Code extensions and elevate the quality of your user interface effortlessly.
Apache License 2.0
243 stars 67 forks source link

[🚫 Bug] Unpack of stable version of VSCode on win32 fails #1323

Open RobineClaire opened 1 month ago

RobineClaire commented 1 month ago

Describe the bug

When installing the test environment, VSCode is downloaded has a zip file as I'm under windows, but the unpack function tries to unpack with tar -zxf. I thonk that the faulty code is in vscode-extension-tester/tree/main/packages/extester/src/util/unpack.ts

        } else if (input.toString().endsWith('.zip')) {
            fs.mkdirpSync(target.toString());
            if (process.platform === 'darwin' || process.platform === 'linux') {
                exec(`cd ${target} && unzip -qo ${input.toString()}`, (err) => {
                    if (err) {
                        reject(new Error(err.message));
                    } else {
                        resolve();
                    }
                });
            } else {
                exec(`cd ${target} && tar -xvf ${input.toString()}`, (err) => {
                    if (err) {
                        reject(new Error(err.message));
                    } else {
                        resolve();
                    }
                });
            }

Steps to reproduce

To reproduce, extest setup-tests -c 1.85.0 -s test-resources under a windows platform.

Logs

Traces :
> extest setup-tests -c 1.85.0 -s test-resources

WARNING: You are using the outdated VS Code version '1.85.0'. The latest stable version is '1.89.1'.

Downloading VS Code: 1.85.0 / stable
Downloading VS Code from: https://update.code.visualstudio.com/1.85.0/win32-x64-archive/stable
progress: 0/157 (0%)
progress: 8503284/131526343 (6%)
progress: 14254069/131526343 (10%)
progress: 24543217/131526343 (18%)
progress: 33472496/131526343 (25%)
progress: 36012021/131526343 (27%)
progress: 39878649/131526343 (30%)
progress: 44908534/131526343 (34%)
progress: 50806782/131526343 (38%)
progress: 54935538/131526343 (41%)
progress: 58720251/131526343 (44%)
progress: 63324146/131526343 (48%)
progress: 69468155/131526343 (52%)
progress: 73547762/131526343 (55%)
progress: 79724537/131526343 (60%)
progress: 84066288/131526343 (63%)
progress: 88850428/131526343 (67%)
progress: 92848120/131526343 (70%)
progress: 99319805/131526343 (75%)
progress: 105185271/131526343 (79%)
progress: 112427005/131526343 (85%)
progress: 119537659/131526343 (90%)
progress: 129155056/131526343 (98%)
progress: 131526343/131526343 (100%)
Downloaded VS Code into C:\Users\robinec\Downloads\VSCodeTests\stxp-tests\test-resources\stable.zip
Unpacking VS Code into C:\Users\robinec\Downloads\VSCodeTests\stxp-tests\test-resources
Error: Command failed: cd vscodeW7Rpu9 && tar -xvf C:\Users\robinec\Downloads\VSCodeTests\stxp-tests\test-resources\stable.zip
tar: Cannot connect to C: resolve failed

    at ChildProcess.exithandler (node:child_process:398:12)
    at ChildProcess.emit (node:events:527:28)
    at maybeClose (node:internal/child_process:1092:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)

Operating System

Windows 10

Visual Studio Code

1.85.0

vscode-extension-tester

7.2.0

NodeJS

16.15.0

npm

8.5.5

c3-WesleyPickering commented 1 month ago

I'm also encountering this issue, is there any workaround?

HegelPro commented 1 month ago

Same problem

DavyLandman commented 3 weeks ago

I think it's a duplicate of #1212 can you run it outside of git bash to see if that fixes it?

RobineClaire commented 3 weeks ago

Yes, it seems to be the same bug. The problem appears not only under git bash, but also in a msys terminal. I can't test in a powershell or cmd environment, as my process is automated on a deported environment.

NevEinsit commented 3 weeks ago

Yes, it seems to be the same bug. The problem appears not only under git bash, but also in a msys terminal. I can't test in a powershell or cmd environment, as my process is automated on a deported environment.

The way I workaround this is to install another unpacking software (7z, for instance) and replace the use of "tar -xvf" to the software I installed:

call npm install
sed -i -e 's/tar -xvf ${input.toString()}/"C:\/Program Files\/7-Zip\/7z" x -bd  ${input.toString()} /g' ./node_modules/vscode-extension-tester/out/util/unpack.js
:: conitnue the pipeline
RobineClaire commented 2 weeks ago

Thanks for the workaround, it works for me, waiting for the official fix !