From 6f608ba4a60bee10d780a072fb8974dd10a40160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Pupier?= Date: Thu, 21 Dec 2023 09:51:02 +0100 Subject: [PATCH] Use latest 18.x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit it requires to get rid of unzipper which was corrupting the extracted binary of chromedriver on Linux and VS Code on Windows with Node 18.15+ fixes #975 Signed-off-by: Aurélien Pupier --- .github/workflows/insiders.yml | 2 +- .github/workflows/template-main.yaml | 2 +- README.md | 2 +- package-lock.json | 140 --------------------------- package.json | 2 - src/extester.ts | 13 --- src/util/unpack.ts | 24 ++--- 7 files changed, 11 insertions(+), 174 deletions(-) diff --git a/.github/workflows/insiders.yml b/.github/workflows/insiders.yml index a10117f44..d8f6b87b5 100644 --- a/.github/workflows/insiders.yml +++ b/.github/workflows/insiders.yml @@ -30,7 +30,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: 18.15.x + node-version: 18.x cache: npm - name: Run Tests (macOS, windows) diff --git a/.github/workflows/template-main.yaml b/.github/workflows/template-main.yaml index c643c80c5..5b3d409fc 100644 --- a/.github/workflows/template-main.yaml +++ b/.github/workflows/template-main.yaml @@ -27,7 +27,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: 18.15.x + node-version: 18.x cache: npm - name: Run Tests (macOS, windows) diff --git a/README.md b/README.md index 451094df3..8037add6b 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ |NodeJS|Visual Studio Code|Operating System| |--|--|--| -|
16.x.x18.x.x
⚠️ <=18.15.x
|
min-max
1.84.21.85.21.86.2
|
LinuxWindowsmacOS
⚠️ [Known Issues](KNOWN_ISSUES.md#macos-known-limitations-of-native-objects)
| +|
16.x.x18.x.x
|
min-max
1.84.21.85.21.86.2
|
LinuxWindowsmacOS
⚠️ [Known Issues](KNOWN_ISSUES.md#macos-known-limitations-of-native-objects)
| ### Usage diff --git a/package-lock.json b/package-lock.json index 51e873048..a2fd54594 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,6 @@ "sanitize-filename": "^1.6.3", "selenium-webdriver": "^4.18.1", "targz": "^1.0.1", - "unzipper": "^0.10.14", "vscode-extension-tester-locators": "^3.11.0" }, "bin": { @@ -38,7 +37,6 @@ "@types/js-yaml": "^4.0.9", "@types/mocha": "^10.0.6", "@types/node": "^18.17.15", - "@types/unzipper": "^0.10.9", "mocha": "^10.3.0", "rimraf": "^5.0.5", "typescript": "*" @@ -260,15 +258,6 @@ "@types/tar-fs": "*" } }, - "node_modules/@types/unzipper": { - "version": "0.10.9", - "resolved": "https://registry.npmjs.org/@types/unzipper/-/unzipper-0.10.9.tgz", - "integrity": "sha512-vHbmFZAw8emNAOVkHVbS3qBnbr0x/qHQZ+ei1HE7Oy6Tyrptl+jpqnOX+BF5owcu/HZLOV0nJK+K9sjs1Ox2JA==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/ws": { "version": "8.5.3", "license": "MIT", @@ -501,21 +490,6 @@ "license": "MIT", "optional": true }, - "node_modules/big-integer": { - "version": "1.6.51", - "license": "Unlicense", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/binary": { - "version": "0.3.0", - "license": "MIT", - "dependencies": { - "buffers": "~0.1.1", - "chainsaw": "~0.1.0" - } - }, "node_modules/binary-extensions": { "version": "2.2.0", "dev": true, @@ -532,10 +506,6 @@ "safe-buffer": "^5.1.1" } }, - "node_modules/bluebird": { - "version": "3.4.7", - "license": "MIT" - }, "node_modules/boolbase": { "version": "1.0.0", "license": "ISC" @@ -608,19 +578,6 @@ "version": "1.0.0", "license": "MIT" }, - "node_modules/buffer-indexof-polyfill": { - "version": "1.0.2", - "license": "MIT", - "engines": { - "node": ">=0.10" - } - }, - "node_modules/buffers": { - "version": "0.1.1", - "engines": { - "node": ">=0.2.0" - } - }, "node_modules/cacheable-lookup": { "version": "7.0.0", "license": "MIT", @@ -666,13 +623,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/chainsaw": { - "version": "0.1.0", - "license": "MIT/X11", - "dependencies": { - "traverse": ">=0.3.0 <0.4" - } - }, "node_modules/chalk": { "version": "4.1.2", "dev": true, @@ -1004,13 +954,6 @@ "url": "https://github.com/fb55/domutils?sponsor=1" } }, - "node_modules/duplexer2": { - "version": "0.1.4", - "license": "BSD-3-Clause", - "dependencies": { - "readable-stream": "^2.0.2" - } - }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -1199,65 +1142,6 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/fstream": { - "version": "1.0.12", - "license": "ISC", - "dependencies": { - "graceful-fs": "^4.1.2", - "inherits": "~2.0.0", - "mkdirp": ">=0.5 0", - "rimraf": "2" - }, - "engines": { - "node": ">=0.6" - } - }, - "node_modules/fstream/node_modules/brace-expansion": { - "version": "1.1.11", - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/fstream/node_modules/glob": { - "version": "7.2.3", - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/fstream/node_modules/minimatch": { - "version": "3.1.2", - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/fstream/node_modules/rimraf": { - "version": "2.7.1", - "license": "ISC", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, "node_modules/function-bind": { "version": "1.1.1", "license": "MIT" @@ -1747,10 +1631,6 @@ "uc.micro": "^1.0.1" } }, - "node_modules/listenercount": { - "version": "1.0.1", - "license": "ISC" - }, "node_modules/locate-path": { "version": "6.0.0", "dev": true, @@ -2806,10 +2686,6 @@ "node": ">=8.0" } }, - "node_modules/traverse": { - "version": "0.3.9", - "license": "MIT/X11" - }, "node_modules/truncate-utf8-bytes": { "version": "1.0.2", "license": "WTFPL", @@ -2885,22 +2761,6 @@ "node": ">= 10.0.0" } }, - "node_modules/unzipper": { - "version": "0.10.14", - "license": "MIT", - "dependencies": { - "big-integer": "^1.6.17", - "binary": "~0.3.0", - "bluebird": "~3.4.1", - "buffer-indexof-polyfill": "~1.0.0", - "duplexer2": "~0.1.4", - "fstream": "^1.0.12", - "graceful-fs": "^4.2.2", - "listenercount": "~1.0.1", - "readable-stream": "~2.3.6", - "setimmediate": "~1.0.4" - } - }, "node_modules/url-join": { "version": "4.0.1", "license": "MIT" diff --git a/package.json b/package.json index 56d162631..39ad5b386 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,6 @@ "@types/js-yaml": "^4.0.9", "@types/mocha": "^10.0.6", "@types/node": "^18.17.15", - "@types/unzipper": "^0.10.9", "mocha": "^10.3.0", "rimraf": "^5.0.5", "typescript": "*" @@ -68,7 +67,6 @@ "sanitize-filename": "^1.6.3", "selenium-webdriver": "^4.18.1", "targz": "^1.0.1", - "unzipper": "^0.10.14", "vscode-extension-tester-locators": "^3.11.0" }, "peerDependencies": { diff --git a/src/extester.ts b/src/extester.ts index 734df9c9a..eb05ddfb3 100644 --- a/src/extester.ts +++ b/src/extester.ts @@ -32,12 +32,6 @@ export const DEFAULT_STORAGE_FOLDER = process.env.TEST_RESOURCES ? process.env.T export const VSCODE_VERSION_MIN = '1.84.2'; export const VSCODE_VERSION_MAX = '1.86.2'; -/** - * The latest version of NodeJS which is properly working with selenium-webdriver - * (for more details, see https://www.npmjs.com/package/selenium-webdriver?activeTab=readme#node-support-policy) - */ -export const NODEJS_VERSION_MAX = '18.15.0'; - /** * ExTester */ @@ -48,13 +42,6 @@ export class ExTester { constructor(storageFolder: string = DEFAULT_STORAGE_FOLDER, releaseType: ReleaseQuality = ReleaseQuality.Stable, extensionsDir?: string) { this.code = new CodeUtil(storageFolder, releaseType, extensionsDir); this.chrome = new DriverUtil(storageFolder); - - if (process.versions.node > NODEJS_VERSION_MAX) { - console.log( - '\x1b[31m%s\x1b[0m', - `\nERROR:\tYou are using the unsupported NodeJS version '${process.versions.node}'. The latest supported version is '${NODEJS_VERSION_MAX}'.\n\tWe recommend to use supported version to have ExTester working properly.\n\tMore info at https://github.com/redhat-developer/vscode-extension-tester/issues/975\n\n` - ); - } } /** diff --git a/src/util/unpack.ts b/src/util/unpack.ts index 838a1a907..f71522bf9 100644 --- a/src/util/unpack.ts +++ b/src/util/unpack.ts @@ -1,7 +1,6 @@ import * as fs from 'fs-extra'; import { exec } from 'child_process'; import targz from 'targz'; -import * as unzipper from 'unzipper'; export class Unpack { static unpack(input: fs.PathLike, target: fs.PathLike): Promise { @@ -15,21 +14,14 @@ export class Unpack { }); } else if (input.toString().endsWith('.zip')) { - if (process.platform === 'darwin') { - fs.mkdirpSync(target.toString()); - exec(`cd ${target} && unzip -qo ${input.toString()}`, (err) => { - if (err) { - reject(err); - } else { - resolve(); - } - }); - } else { - fs.createReadStream(input) - .pipe(unzipper.Extract({ path: target.toString() })) - .on('error', reject) - .on('close', resolve); - } + fs.mkdirpSync(target.toString()); + exec(`cd ${target} && tar -xvf ${input.toString()}`, (err) => { + if (err) { + reject(err); + } else { + resolve(); + } + }); } else { reject(`Unsupported extension for '${input}'`);