🐛 Fix testing under Linux and Windows

This commit is contained in:
Tw93
2025-08-22 08:27:06 +08:00
parent 4bb900cd75
commit 6c163ca11f

View File

@@ -619,21 +619,21 @@ class PakeTestRunner {
linux: { linux: {
app: path.join( app: path.join(
config.PROJECT_ROOT, config.PROJECT_ROOT,
`src-tauri/target/release/bundle/deb/*.deb`, `src-tauri/target/release/pake`,
), ),
installer: path.join( installer: path.join(
config.PROJECT_ROOT, config.PROJECT_ROOT,
`src-tauri/target/release/bundle/appimage/*.AppImage`, `src-tauri/target/release/bundle/deb/*.deb`,
), ),
}, },
win32: { win32: {
app: path.join( app: path.join(
config.PROJECT_ROOT, config.PROJECT_ROOT,
`src-tauri/target/x86_64-pc-windows-msvc/release/pake.exe`, `src-tauri/target/release/pake.exe`,
), ),
installer: path.join( installer: path.join(
config.PROJECT_ROOT, config.PROJECT_ROOT,
`src-tauri/target/x86_64-pc-windows-msvc/release/bundle/msi/*.msi`, `src-tauri/target/release/bundle/msi/*.msi`,
), ),
}, },
}; };
@@ -689,7 +689,11 @@ class PakeTestRunner {
console.log(" ✅ Compilation finished!"); console.log(" ✅ Compilation finished!");
// Capture error output for debugging // Capture error output for debugging
if (output.includes("error:") || output.includes("Error:") || output.includes("ERROR")) { if (
output.includes("error:") ||
output.includes("Error:") ||
output.includes("ERROR")
) {
errorOutput += output; errorOutput += output;
} }
}); });
@@ -739,12 +743,18 @@ class PakeTestRunner {
); );
if (appExists || installerExists) { if (appExists || installerExists) {
console.log(" 🎉 Real build test SUCCESS: Build file(s) generated!"); console.log(
" 🎉 Real build test SUCCESS: Build file(s) generated!",
);
if (appExists) { if (appExists) {
console.log(` 📱 App location: ${actualAppPath}`); console.log(` 📱 App location: ${actualAppPath}`);
} }
if (installerExists) { if (installerExists) {
console.log(` 💿 Installer location: ${actualInstallerPath}`); console.log(` 💿 Installer location: ${actualInstallerPath}`);
} else if (appExists && !installerExists) {
console.log(
" Note: Binary created successfully, but installer package not generated",
);
} }
console.log(" ✨ Build artifacts preserved for inspection"); console.log(" ✨ Build artifacts preserved for inspection");
resolve(true); resolve(true);
@@ -753,16 +763,25 @@ class PakeTestRunner {
" ⚠️ Build process completed but no build files found", " ⚠️ Build process completed but no build files found",
); );
console.log(` 📍 Expected app location: ${expectedFiles.app}`); console.log(` 📍 Expected app location: ${expectedFiles.app}`);
console.log(` 📍 Expected installer location: ${expectedFiles.installer}`); console.log(
` 📍 Expected installer location: ${expectedFiles.installer}`,
);
// Debug: List actual files in target directories to help diagnose // Debug: List actual files in target directories to help diagnose
const targetDir = path.join(config.PROJECT_ROOT, 'src-tauri/target'); const targetDir = path.join(
config.PROJECT_ROOT,
"src-tauri/target",
);
if (fs.existsSync(targetDir)) { if (fs.existsSync(targetDir)) {
console.log(" 🔍 Debug: Listing target directory structure..."); console.log(
" 🔍 Debug: Listing target directory structure...",
);
try { try {
this.listTargetContents(targetDir); this.listTargetContents(targetDir);
} catch (error) { } catch (error) {
console.log(` ⚠️ Could not list target contents: ${error.message}`); console.log(
` ⚠️ Could not list target contents: ${error.message}`,
);
} }
} }
@@ -770,28 +789,37 @@ class PakeTestRunner {
} else { } else {
console.log(` ❌ Build process failed with exit code: ${code}`); console.log(` ❌ Build process failed with exit code: ${code}`);
if (buildStarted) { if (buildStarted) {
console.log(" 📊 Build was started but failed during execution"); console.log(
" 📊 Build was started but failed during execution",
);
if (errorOutput.trim()) { if (errorOutput.trim()) {
console.log(" 🔍 Error details:"); console.log(" 🔍 Error details:");
errorOutput.split('\n').forEach(line => { errorOutput.split("\n").forEach((line) => {
if (line.trim()) console.log(` ${line.trim()}`); if (line.trim()) console.log(` ${line.trim()}`);
}); });
} }
// Debug: List actual files in target directories to help diagnose // Debug: List actual files in target directories to help diagnose
const targetDir = path.join(config.PROJECT_ROOT, 'src-tauri/target'); const targetDir = path.join(
config.PROJECT_ROOT,
"src-tauri/target",
);
if (fs.existsSync(targetDir)) { if (fs.existsSync(targetDir)) {
console.log(" 🔍 Debug: Listing target directory structure..."); console.log(
" 🔍 Debug: Listing target directory structure...",
);
try { try {
this.listTargetContents(targetDir); this.listTargetContents(targetDir);
} catch (error) { } catch (error) {
console.log(` ⚠️ Could not list target contents: ${error.message}`); console.log(
` ⚠️ Could not list target contents: ${error.message}`,
);
} }
} }
} else { } else {
console.log(" 📊 Build failed before starting compilation"); console.log(" 📊 Build failed before starting compilation");
if (errorOutput.trim()) { if (errorOutput.trim()) {
console.log(" 🔍 Error details:"); console.log(" 🔍 Error details:");
errorOutput.split('\n').forEach(line => { errorOutput.split("\n").forEach((line) => {
if (line.trim()) console.log(` ${line.trim()}`); if (line.trim()) console.log(` ${line.trim()}`);
}); });
} }
@@ -1103,14 +1131,14 @@ class PakeTestRunner {
try { try {
const items = fs.readdirSync(targetDir); const items = fs.readdirSync(targetDir);
items.forEach(item => { items.forEach((item) => {
const fullPath = path.join(targetDir, item); const fullPath = path.join(targetDir, item);
const relativePath = path.relative(config.PROJECT_ROOT, fullPath); const relativePath = path.relative(config.PROJECT_ROOT, fullPath);
const indent = " ".repeat(currentDepth + 1); const indent = " ".repeat(currentDepth + 1);
if (fs.statSync(fullPath).isDirectory()) { if (fs.statSync(fullPath).isDirectory()) {
console.log(`${indent}📁 ${relativePath}/`); console.log(`${indent}📁 ${relativePath}/`);
if (item === 'bundle' || item === 'release') { if (item === "bundle" || item === "release") {
this.listTargetContents(fullPath, maxDepth, currentDepth + 1); this.listTargetContents(fullPath, maxDepth, currentDepth + 1);
} }
} else { } else {