Fix nodejs tests

This commit is contained in:
Caelan Sayler
2024-10-20 14:50:05 +01:00
committed by Caelan
parent 1f463f4756
commit d443f81f4e
3 changed files with 22 additions and 22 deletions

View File

@@ -6,7 +6,7 @@
"types": "./lib/index.d.ts",
"scripts": {
"test": "npm run dev && cross-env VELOPACK_RESTART=true VELOPACK_DEBUG=true jest",
"dev": "cargo build -p velopack_nodeffi && tsc -p tsconfig.build.json && node copy-lib.js",
"dev": "cargo build -p velopack_nodeffi -p velopack_bins && tsc -p tsconfig.build.json && node copy-lib.js",
"build": "tsc -p tsconfig.build.json",
"clean": "del-cli **/*.node lib velopack-*.tgz",
"lint": "prettier . --write"

View File

@@ -2,17 +2,11 @@ import { proxy } from "@neon-rs/load";
module.exports = proxy({
platforms: {
"win32-x86-msvc": () =>
require("./native/velopack_nodeffi_win_x86_msvc.node"),
"win32-x64-msvc": () =>
require("./native/velopack_nodeffi_win_x64_msvc.node"),
"win32-arm64-msvc": () =>
require("./native/velopack_nodeffi_win_arm64_msvc.node"),
"win32-x64-msvc": () => require("./native/velopack_nodeffi_win_x64_msvc.node"),
"win32-arm64-msvc": () => require("./native/velopack_nodeffi_win_arm64_msvc.node"),
"darwin-x64": () => require("./native/velopack_nodeffi_osx.node"),
"darwin-arm64": () => require("./native/velopack_nodeffi_osx.node"),
"linux-x64-gnu": () =>
require("./native/velopack_nodeffi_linux_x64_gnu.node"),
"linux-arm64-gnu": () =>
require("./native/velopack_nodeffi_linux_arm64_gnu.node"),
"linux-x64-gnu": () => require("./native/velopack_nodeffi_linux_x64_gnu.node"),
"linux-arm64-gnu": () => require("./native/velopack_nodeffi_linux_arm64_gnu.node"),
},
});

View File

@@ -116,27 +116,29 @@ export async function tempd3<T>(
export function updateExe(): string {
const paths = [];
const debugDir = path.join("..", "..", "target", "debug");
const releaseDir = path.join("..", "..", "target", "release");
if (isMacos()) {
paths.push(path.join("..", "..", "target", "release", "UpdateMac"));
paths.push(path.join(releaseDir, "UpdateMac"));
}
if (isLinux()) {
if (os.machine() == "x86_64") {
paths.push(path.join("..", "..", "target", "release", "UpdateNix_x64"));
paths.push(path.join(releaseDir, "UpdateNix_x64"));
} else if (os.machine() == "aarch64" || os.machine() == "arm64") {
paths.push(path.join("..", "..", "target", "release", "UpdateNix_arm64"));
paths.push(path.join(releaseDir, "UpdateNix_arm64"));
}
}
if (isMacos() || isLinux()) {
paths.push(path.join("..", "..", "target", "debug", "update"));
paths.push(path.join("..", "..", "target", "release", "update"));
paths.push(path.join(debugDir, "update"));
paths.push(path.join(releaseDir, "update"));
}
if (isWindows()) {
paths.push(path.join("..", "..", "target", "debug", "Update.exe"));
paths.push(path.join("..", "..", "target", "release", "Update.exe"));
paths.push(path.join(debugDir, "Update.exe"));
paths.push(path.join(releaseDir, "Update.exe"));
}
for (const p of paths) {
@@ -151,12 +153,16 @@ export function updateExe(): string {
paths.join(", ") +
". And found these binaries: ";
for (const file of fs.readdirSync(path.join("..", "..", "target", "debug"))) {
message += file + ", ";
if (fs.existsSync(debugDir)) {
for (const file of fs.readdirSync(debugDir)) {
message += file + ", ";
}
}
for (const file of fs.readdirSync(path.join("..", "..", "target", "release"))) {
message += file + ", ";
if (fs.existsSync(releaseDir)) {
for (const file of fs.readdirSync(releaseDir)) {
message += file + ", ";
}
}
throw new Error(message);