fix: windows e2e harness

This commit is contained in:
zhom committed 2026-09-26 10:38:31 +04:00
1 parent f02938bf14
commit 96f60b5fd3
3 files changed
+42 -1

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
fn main() {
// The harness links Donut as a library, and a dependency's link arguments
// never reach this binary. Without the Common Controls v6 manifest Windows
// loads comctl32 v5, and the app dies at startup with
// STATUS_ENTRYPOINT_NOT_FOUND (0xc0000139) before WebDriver can attach.
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") {
let manifest_dir = std::path::PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
let manifest = manifest_dir
.parent()
.and_then(|e2e| e2e.parent())
.expect("e2e/app sits two levels below the repository root")
.join("src-tauri")
.join("app.manifest");
// A plain backslash path: mt.exe rejects the \\?\ form canonicalize gives.
let manifest = manifest.to_str().unwrap().replace('/', "\\");
println!("cargo:rustc-link-arg=/MANIFEST:EMBED");
println!("cargo:rustc-link-arg=/MANIFESTINPUT:{manifest}");
println!("cargo:rerun-if-changed={manifest}");
}
}
+11
View File
@@ -123,6 +123,17 @@ export class AppSession {
mkdir(path.join(this.root, "home"), { recursive: true }),
mkdir(path.join(this.root, "tmp"), { recursive: true }),
mkdir(path.join(this.root, "artifacts"), { recursive: true }),
// Windows expands the known folders from %USERPROFILE%, which points at
// the isolated home. A missing AppData\Roaming makes
// SHGetKnownFolderPath fail, and the app cannot resolve its base
// directories at startup.
...(process.platform === "win32"
? ["Roaming", "Local"].map((folder) =>
mkdir(path.join(this.root, "home", "AppData", folder), {
recursive: true,
}),
)
: []),
]);
if (this.onboardingCompleted) {
const settingsFile = path.join(
+11 -1
View File
@@ -107,7 +107,17 @@ function log(message) {
function run(command, args, cwd, env = process.env) {
log(`${command} ${args.join(" ")}`);
const result = spawnSync(command, args, { cwd, env, stdio: "inherit" });
// pnpm is a .cmd shim on Windows, and Node starts those only through a
// shell. The arguments here are fixed words, so joining them is safe.
const result =
isWindows && command === "pnpm"
? spawnSync([command, ...args].join(" "), {
cwd,
env,
stdio: "inherit",
shell: true,
})
: spawnSync(command, args, { cwd, env, stdio: "inherit" });
if (result.error) {
throw result.error;
}