diff --git a/package-lock.json b/package-lock.json index e60ad14..1b87eb2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "MIT", "dependencies": { "semver": "^7.7.3", - "tar": "^7.5.2", + "tar": "^7.5.3", "yauzl-promise": "^4.0.0" } }, @@ -497,9 +497,9 @@ } }, "node_modules/tar": { - "version": "7.5.2", - "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.2.tgz", - "integrity": "sha512-7NyxrTE4Anh8km8iEy7o0QYPs+0JKBTj5ZaqHg6B39erLg0qYXN3BijtShwbsNSvQ+LN75+KV+C4QR/f6Gwnpg==", + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.3.tgz", + "integrity": "sha512-ENg5JUHUm2rDD7IvKNFGzyElLXNjachNLp6RaGf4+JOgxXHkqA+gq81ZAMCUmtMtqBsoU62lcp6S27g1LCYGGQ==", "license": "BlueOak-1.0.0", "dependencies": { "@isaacs/fs-minipass": "^4.0.0", diff --git a/package.json b/package.json index 2c18e28..399a2de 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ }, "dependencies": { "semver": "^7.7.3", - "tar": "^7.5.2", + "tar": "^7.5.3", "yauzl-promise": "^4.0.0" } } diff --git a/tests/specs/decompress.test.js b/tests/specs/decompress.test.js new file mode 100644 index 0000000..24e320f --- /dev/null +++ b/tests/specs/decompress.test.js @@ -0,0 +1,28 @@ +import assert from "node:assert/strict"; +import fs from "node:fs"; +import path from "node:path"; +import { before, describe, it } from "node:test"; + +import decompress from "../../src/decompress.js"; + +describe("decompress test suite", function () { + + const platform = process.platform === "win32" ? "win" : process.platform === "darwin" ? "osx" : "linux"; + + const nwFilePath = path.resolve("cache", `nwjs-v0.107.0-${platform}-${process.arch}.${platform === "linux" ? "tar.gz": "zip"}`); + const outFilePath = path.resolve("cache", `nwjs-v0.107.0-${platform}-${process.arch}`) + + before(function () { + fs.rmSync(outFilePath, { recursive: true, force: true }); + }); + + it("decompresses a .zip file", {skip: platform === "linux" } ,async function () { + await decompress(nwFilePath, path.resolve("cache")); + assert.strictEqual(fs.existsSync(outFilePath), true); + }); + + it("decompresses a .tar.gz file", {skip: platform !== "linux" }, async function () { + await decompress(nwFilePath, path.resolve("cache")); + assert.strictEqual(fs.existsSync(outFilePath), true); + }); +}); diff --git a/tests/specs/demo.js b/tests/specs/demo.js deleted file mode 100644 index e69de29..0000000