Skip to content

Commit

Permalink
fix linux path
Browse files Browse the repository at this point in the history
  • Loading branch information
amr-crabnebula committed Nov 23, 2023
1 parent 2be80ce commit b869003
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions bindings/updater/nodejs/__test__/index.spec.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from "ava";
import { writeFile, stat, readFile, rename, readdir } from "fs/promises";
import { writeFile, stat, readFile, rename } from "fs/promises";
import { join, extname, format, parse } from "path";
import { execa } from "execa";
import { fileURLToPath } from "url";
Expand All @@ -26,7 +26,7 @@ test("it works", async (t) => {
const buildApp = async (version, updaterFormats) => {
await writeFile(
join(appDir, "dist", "ver.js"),
`module.exports.version = "${version}";`
`module.exports.version = "${version}";`,
);

try {
Expand All @@ -47,7 +47,7 @@ test("it works", async (t) => {
CARGO_PACKAGER_SIGN_PRIVATE_KEY: UPDATER_PRIVATE_KEY,
CARGO_PACKAGER_SIGN_PRIVATE_KEY_PASSWORD: "",
},
}
},
);
} catch (e) {
console.error("failed to package app");
Expand All @@ -58,7 +58,7 @@ test("it works", async (t) => {
// bundle app update
await buildApp(
"1.0.0",
isWindows ? ["nsis", "wix"] : isMacos ? ["app"] : ["appimage"]
isWindows ? ["nsis", "wix"] : isMacos ? ["app"] : ["appimage"],
);

const packgePaths = (version) => {
Expand All @@ -75,11 +75,19 @@ test("it works", async (t) => {
]
: isMacos
? [["app", join(appDir, "dist", "PackagerAppUpdaterTestNodejs.app")]]
: [["appimage", `updater-app-test_${version}_x86_64.AppImage`]];
: [
[
"appimage",
join(
appDir,
"dist",
`updater-app-test_${version}_x86_64.AppImage`,
),
],
];
};

for (const [updaterFormat, outPackagePath] of packgePaths("1.0.0")) {
console.log(await readdir(join(appDir, "dist")));
const outUpdaterPath = (await stat(outPackagePath)).isDirectory()
? `${outPackagePath}${extname(outPackagePath)}.tar.gz`
: outPackagePath;
Expand Down Expand Up @@ -148,7 +156,7 @@ test("it works", async (t) => {
? "updater-app-test.exe"
: isMacos
? "PackagerAppUpdaterTestNodejs.app/Contents/MacOS/cargo-packager-updater-app-test"
: `updater-app-test_${version}_x86_64.AppImage`
: `updater-app-test_${version}_x86_64.AppImage`,
);

// wait until the update is finished and the new version has been installed
Expand Down Expand Up @@ -177,7 +185,7 @@ test("it works", async (t) => {
counter += 1;
if (counter == 10) {
console.error(
"updater test timedout and couldn't verify the update has happened"
"updater test timedout and couldn't verify the update has happened",
);
break;
}
Expand Down

0 comments on commit b869003

Please sign in to comment.