mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-09-24 15:49:09 +00:00
5633631840
* fix(ci): reduce flaky failures and PR runtime * fix(ci): avoid label scope failures * fix(ci): tolerate GitHub download outages * fix(ci): cover packaged inputs in PR triggers * fix(ci): keep test-only changes out of package builds * perf(ci): reuse unchanged ET PR builds * fix: address Codex review on PR #2474 * fix(ci): harden automation PR handoffs * fix(ci): preserve reused implementation branches * fix(ci): deduplicate automation follow-ups * fix(ci): deduplicate automation follow-ups * fix(ci): ignore remapped stale Codex findings * fix(ci): use the established handoff label * fix(ci): isolate manual package validations * fix(ci): refresh existing Nix metadata PRs * fix(ci): hand off divergent implementation branches * fix(ci): serialize Homebrew tap updates --------- Co-authored-by: netcatty-bot <308658023+netcatty-bot@users.noreply.github.com>
42 lines
1.4 KiB
JavaScript
42 lines
1.4 KiB
JavaScript
const test = require("node:test");
|
|
const assert = require("node:assert/strict");
|
|
const { createRequire } = require("node:module");
|
|
|
|
test("electron-builder classifies Fetch API 5xx responses as retryable", async () => {
|
|
const modulePath = require.resolve("app-builder-lib/out/util/electronGet.js");
|
|
const localRequire = createRequire(modulePath);
|
|
const runtime = localRequire("builder-util-runtime");
|
|
const retryDescriptor = Object.getOwnPropertyDescriptor(runtime, "retry");
|
|
let retryOptions;
|
|
|
|
Object.defineProperty(runtime, "retry", {
|
|
configurable: true,
|
|
value: async (_task, options) => {
|
|
retryOptions = options;
|
|
throw new Error("retry-probe");
|
|
},
|
|
});
|
|
delete require.cache[modulePath];
|
|
|
|
try {
|
|
const electronGet = require(modulePath);
|
|
await assert.rejects(
|
|
electronGet.downloadElectronArtifactZip({
|
|
version: "99.99.99",
|
|
platformName: "darwin",
|
|
arch: "x64",
|
|
artifactName: "electron-retry-probe",
|
|
}),
|
|
/retry-probe/,
|
|
);
|
|
|
|
assert.equal(retryOptions.shouldRetry({ response: { status: 504 } }), true);
|
|
assert.equal(retryOptions.shouldRetry({ response: { statusCode: 503 } }), true);
|
|
assert.equal(retryOptions.shouldRetry({ response: { status: 404 } }), false);
|
|
assert.equal(retryOptions.shouldRetry({ code: "ECONNRESET" }), true);
|
|
} finally {
|
|
Object.defineProperty(runtime, "retry", retryDescriptor);
|
|
delete require.cache[modulePath];
|
|
}
|
|
});
|