@todesktop/cli 1.7.0-2 → 1.7.0-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -4437,6 +4437,8 @@ function SmokeTestView({
4437
4437
  case "build-error": {
4438
4438
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(BuildError, { build: state.build, message: (_a = state.error) == null ? void 0 : _a.message });
4439
4439
  }
4440
+ case "canceled":
4441
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_ink36.Text, { children: "Smoke test canceled." });
4440
4442
  case "complete":
4441
4443
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_ink36.Text, { bold: true, color: "greenBright", children: "Smoke test passed." });
4442
4444
  case "error":
@@ -4494,6 +4496,52 @@ function isBuildTestable(build) {
4494
4496
  return false;
4495
4497
  }
4496
4498
  }
4499
+ function isTestRunning(build) {
4500
+ const { isFinished } = makeProgress(build);
4501
+ return !isFinished;
4502
+ }
4503
+ function makeProgress(build) {
4504
+ var _a, _b, _c, _d, _e, _f;
4505
+ const def = {
4506
+ progress: 0,
4507
+ state: "progress",
4508
+ shouldSkip: false
4509
+ };
4510
+ const linux = {
4511
+ ...((_a = build.smokeTest) == null ? void 0 : _a.linux) || def,
4512
+ shouldSkip: ((_b = build.linux) == null ? void 0 : _b.shouldSkip) || false
4513
+ };
4514
+ const mac = {
4515
+ ...((_c = build.smokeTest) == null ? void 0 : _c.mac) || def,
4516
+ shouldSkip: ((_d = build.mac) == null ? void 0 : _d.shouldSkip) || false
4517
+ };
4518
+ const windows = {
4519
+ ...((_e = build.smokeTest) == null ? void 0 : _e.windows) || def,
4520
+ shouldSkip: ((_f = build.windows) == null ? void 0 : _f.shouldSkip) || false
4521
+ };
4522
+ const platforms = [linux, mac, windows].filter(
4523
+ (p) => !p.shouldSkip && p.state !== "skipped"
4524
+ );
4525
+ const isFinished = build.smokeTest.isCanceled || platforms.every((p) => p.state !== "progress");
4526
+ let totalState = "progress";
4527
+ if (build.smokeTest.isCanceled) {
4528
+ totalState = "canceled";
4529
+ } else if (platforms.every((p) => p.state === "done")) {
4530
+ totalState = "done";
4531
+ } else if (isFinished && platforms.some((p) => p.state === "error")) {
4532
+ totalState = "error";
4533
+ }
4534
+ return {
4535
+ isFinished,
4536
+ linux,
4537
+ mac,
4538
+ windows,
4539
+ total: {
4540
+ error: platforms.filter((p) => p.state === "error").map((p) => p.message).join("\n\n"),
4541
+ state: totalState
4542
+ }
4543
+ };
4544
+ }
4497
4545
  function validateBuild(build) {
4498
4546
  if (build.status !== "succeeded") {
4499
4547
  throw new SmokeError(
@@ -4605,46 +4653,6 @@ async function waitUntilFinished({
4605
4653
  );
4606
4654
  });
4607
4655
  }
4608
- function makeProgress(build) {
4609
- var _a, _b, _c, _d, _e, _f;
4610
- const def = {
4611
- progress: 0,
4612
- state: "progress",
4613
- shouldSkip: false
4614
- };
4615
- const linux = {
4616
- ...((_a = build.smokeTest) == null ? void 0 : _a.linux) || def,
4617
- shouldSkip: ((_b = build.linux) == null ? void 0 : _b.shouldSkip) || false
4618
- };
4619
- const mac = {
4620
- ...((_c = build.smokeTest) == null ? void 0 : _c.mac) || def,
4621
- shouldSkip: ((_d = build.mac) == null ? void 0 : _d.shouldSkip) || false
4622
- };
4623
- const windows = {
4624
- ...((_e = build.smokeTest) == null ? void 0 : _e.windows) || def,
4625
- shouldSkip: ((_f = build.windows) == null ? void 0 : _f.shouldSkip) || false
4626
- };
4627
- const platforms = [linux, mac, windows].filter(
4628
- (p) => !p.shouldSkip && p.state !== "skipped"
4629
- );
4630
- const isFinished = platforms.every((p) => p.state !== "progress");
4631
- let totalState = "progress";
4632
- if (platforms.every((p) => p.state === "done")) {
4633
- totalState = "done";
4634
- } else if (isFinished && platforms.some((p) => p.state === "error")) {
4635
- totalState = "error";
4636
- }
4637
- return {
4638
- isFinished,
4639
- linux,
4640
- mac,
4641
- windows,
4642
- total: {
4643
- error: platforms.filter((p) => p.state === "error").map((p) => p.message).join("\n\n"),
4644
- state: totalState
4645
- }
4646
- };
4647
- }
4648
4656
 
4649
4657
  // src/commands/smoke-test/SmokeTestCommand.tsx
4650
4658
  var import_jsx_runtime42 = require("react/jsx-runtime");
@@ -4719,7 +4727,7 @@ async function smokeTestWorkflow({
4719
4727
  const build = await fetchBuild({ appId, buildId, userId });
4720
4728
  updateState({ appId, build, userId });
4721
4729
  validateBuild(build);
4722
- if (!abortSignal.aborted) {
4730
+ if (!abortSignal.aborted && !isTestRunning(build)) {
4723
4731
  await queueSmokeTest({ appId, buildId, nodeVersion, userId });
4724
4732
  }
4725
4733
  updateState({ state: "progress" });
@@ -4729,9 +4737,13 @@ async function smokeTestWorkflow({
4729
4737
  userId,
4730
4738
  onProgress: (progress) => updateState({ progress })
4731
4739
  });
4732
- updateState({
4733
- state: total.state == "error" ? "progress-error" : "complete"
4734
- });
4740
+ const stateMap = {
4741
+ done: "complete",
4742
+ progress: "complete",
4743
+ error: "progress-error",
4744
+ canceled: "canceled"
4745
+ };
4746
+ updateState({ state: stateMap[total.state] });
4735
4747
  } catch (error) {
4736
4748
  updateState({ error, state: error.type || "error" });
4737
4749
  }
@@ -4741,10 +4753,7 @@ function buildCanBeCanceled(build) {
4741
4753
  if ((_a = build == null ? void 0 : build.smokeTest) == null ? void 0 : _a.isCanceled) {
4742
4754
  return false;
4743
4755
  }
4744
- if (!((_b = build == null ? void 0 : build.smokeTest) == null ? void 0 : _b.buildServerExecutionId)) {
4745
- return false;
4746
- }
4747
- return true;
4756
+ return Boolean((_b = build == null ? void 0 : build.smokeTest) == null ? void 0 : _b.buildServerExecutionId);
4748
4757
  }
4749
4758
  function isCancelable(state) {
4750
4759
  const cancelableStates = ["loading", "progress"];
@@ -4811,7 +4820,7 @@ var package_default = {
4811
4820
  access: "public"
4812
4821
  },
4813
4822
  name: "@todesktop/cli",
4814
- version: "1.7.0-1",
4823
+ version: "1.7.0-2",
4815
4824
  license: "MIT",
4816
4825
  author: "Dave Jeffery <dave@todesktop.com> (http://www.todesktop.com/)",
4817
4826
  homepage: "https://todesktop.com/cli",