@alwaysmeticulous/cli 2.42.0 → 2.42.1

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.
@@ -5,6 +5,7 @@ const common_1 = require("@alwaysmeticulous/common");
5
5
  const replay_orchestrator_1 = require("@alwaysmeticulous/replay-orchestrator");
6
6
  const command_builder_1 = require("../../command-utils/command-builder");
7
7
  const common_options_1 = require("../../command-utils/common-options");
8
+ const out_of_date_client_error_1 = require("../../utils/out-of-date-client-error");
8
9
  const replay_debugger_ui_1 = require("./utils/replay-debugger.ui");
9
10
  const rawReplayCommandHandler = async ({ apiToken, commitSha, sessionId, appUrl, simulationIdForAssets, headless, devTools, bypassCSP, screenshot, baseReplayId, diffThreshold, diffPixelThreshold, shiftTime, networkStubbing, moveBeforeClick, cookiesFile, disableRemoteFonts, noSandbox, skipPauses, maxDurationMs, maxEventCount, storyboard, essentialFeaturesOnly, debugger: enableStepThroughDebugger, }) => {
10
11
  if (!screenshot && storyboard) {
@@ -48,38 +49,49 @@ const rawReplayCommandHandler = async ({ apiToken, commitSha, sessionId, appUrl,
48
49
  : { enabled: false };
49
50
  const getOnBeforeUserEventCallback = (0, common_1.defer)();
50
51
  const getOnClosePageCallback = (0, common_1.defer)();
51
- const replayExecution = await (0, replay_orchestrator_1.replayAndStoreResults)({
52
- replayTarget: (0, exports.getReplayTarget)({
53
- appUrl: appUrl !== null && appUrl !== void 0 ? appUrl : null,
54
- simulationIdForAssets: simulationIdForAssets !== null && simulationIdForAssets !== void 0 ? simulationIdForAssets : null,
55
- }),
56
- executionOptions,
57
- screenshottingOptions,
58
- apiToken,
59
- commitSha,
60
- cookiesFile,
61
- sessionId,
62
- generatedBy: generatedByOption,
63
- testRunId: null,
64
- suppressScreenshotDiffLogging: false,
65
- ...(enableStepThroughDebugger
66
- ? {
67
- onBeforeUserEvent: async (options) => (await getOnBeforeUserEventCallback.promise)(options),
68
- onClosePage: async () => (await getOnClosePageCallback.promise)(),
69
- }
70
- : {}),
71
- });
72
- if (enableStepThroughDebugger) {
73
- const stepThroughDebuggerUI = await (0, replay_debugger_ui_1.openStepThroughDebuggerUI)({
74
- onLogEventTarget: replayExecution.logEventTarget,
75
- onCloseReplayedPage: replayExecution.closePage,
76
- replayableEvents: replayExecution.eventsBeingReplayed,
52
+ try {
53
+ const replayExecution = await (0, replay_orchestrator_1.replayAndStoreResults)({
54
+ replayTarget: (0, exports.getReplayTarget)({
55
+ appUrl: appUrl !== null && appUrl !== void 0 ? appUrl : null,
56
+ simulationIdForAssets: simulationIdForAssets !== null && simulationIdForAssets !== void 0 ? simulationIdForAssets : null,
57
+ }),
58
+ executionOptions,
59
+ screenshottingOptions,
60
+ apiToken,
61
+ commitSha,
62
+ cookiesFile,
63
+ sessionId,
64
+ generatedBy: generatedByOption,
65
+ testRunId: null,
66
+ suppressScreenshotDiffLogging: false,
67
+ ...(enableStepThroughDebugger
68
+ ? {
69
+ onBeforeUserEvent: async (options) => (await getOnBeforeUserEventCallback.promise)(options),
70
+ onClosePage: async () => (await getOnClosePageCallback.promise)(),
71
+ }
72
+ : {}),
73
+ maxSemanticVersionSupported: 1,
77
74
  });
78
- getOnBeforeUserEventCallback.resolve(stepThroughDebuggerUI.onBeforeUserEvent);
79
- getOnClosePageCallback.resolve(stepThroughDebuggerUI.close);
75
+ if (enableStepThroughDebugger) {
76
+ const stepThroughDebuggerUI = await (0, replay_debugger_ui_1.openStepThroughDebuggerUI)({
77
+ onLogEventTarget: replayExecution.logEventTarget,
78
+ onCloseReplayedPage: replayExecution.closePage,
79
+ replayableEvents: replayExecution.eventsBeingReplayed,
80
+ });
81
+ getOnBeforeUserEventCallback.resolve(stepThroughDebuggerUI.onBeforeUserEvent);
82
+ getOnClosePageCallback.resolve(stepThroughDebuggerUI.close);
83
+ }
84
+ const { replay } = await replayExecution.finalResult;
85
+ return replay;
86
+ }
87
+ catch (error) {
88
+ if ((0, out_of_date_client_error_1.isOutOfDateClientError)(error)) {
89
+ throw new out_of_date_client_error_1.OutOfDateCLIError();
90
+ }
91
+ else {
92
+ throw error;
93
+ }
80
94
  }
81
- const { replay } = await replayExecution.finalResult;
82
- return replay;
83
95
  };
84
96
  exports.rawReplayCommandHandler = rawReplayCommandHandler;
85
97
  const getReplayTarget = ({ appUrl, simulationIdForAssets, }) => {
@@ -7,6 +7,7 @@ const replay_orchestrator_1 = require("@alwaysmeticulous/replay-orchestrator");
7
7
  const test_run_api_1 = require("../../api/test-run.api");
8
8
  const command_builder_1 = require("../../command-utils/command-builder");
9
9
  const common_options_1 = require("../../command-utils/common-options");
10
+ const out_of_date_client_error_1 = require("../../utils/out-of-date-client-error");
10
11
  const handler = async ({ apiToken, commitSha: commitSha_, baseCommitSha, appUrl, headless, devTools, bypassCSP, diffThreshold, diffPixelThreshold, shiftTime, networkStubbing, githubSummary, parallelize, parallelTasks: parrelelTasks_, maxRetriesOnFailure, rerunTestsNTimes, useCache, testsFile, disableRemoteFonts, noSandbox, skipPauses, moveBeforeClick, maxDurationMs, maxEventCount, storyboard, essentialFeaturesOnly, baseTestRunId, }) => {
11
12
  const executionOptions = {
12
13
  headless,
@@ -36,23 +37,34 @@ const handler = async ({ apiToken, commitSha: commitSha_, baseCommitSha, appUrl,
36
37
  const cachedTestRunResults = useCache
37
38
  ? await (0, test_run_api_1.getCachedTestRunResults)({ client, commitSha })
38
39
  : [];
39
- const { testRun } = await (0, replay_orchestrator_1.executeTestRun)({
40
- testsFile: testsFile !== null && testsFile !== void 0 ? testsFile : null,
41
- executionOptions,
42
- screenshottingOptions,
43
- apiToken: apiToken !== null && apiToken !== void 0 ? apiToken : null,
44
- commitSha,
45
- baseCommitSha: baseCommitSha !== null && baseCommitSha !== void 0 ? baseCommitSha : null,
46
- baseTestRunId: baseTestRunId !== null && baseTestRunId !== void 0 ? baseTestRunId : null,
47
- appUrl: appUrl !== null && appUrl !== void 0 ? appUrl : null,
48
- parallelTasks: parrelelTasks !== null && parrelelTasks !== void 0 ? parrelelTasks : null,
49
- maxRetriesOnFailure,
50
- rerunTestsNTimes,
51
- cachedTestRunResults,
52
- githubSummary,
53
- });
54
- if (testRun.status === "Failure") {
55
- process.exit(1);
40
+ try {
41
+ const { testRun } = await (0, replay_orchestrator_1.executeTestRun)({
42
+ testsFile: testsFile !== null && testsFile !== void 0 ? testsFile : null,
43
+ executionOptions,
44
+ screenshottingOptions,
45
+ apiToken: apiToken !== null && apiToken !== void 0 ? apiToken : null,
46
+ commitSha,
47
+ baseCommitSha: baseCommitSha !== null && baseCommitSha !== void 0 ? baseCommitSha : null,
48
+ baseTestRunId: baseTestRunId !== null && baseTestRunId !== void 0 ? baseTestRunId : null,
49
+ appUrl: appUrl !== null && appUrl !== void 0 ? appUrl : null,
50
+ parallelTasks: parrelelTasks !== null && parrelelTasks !== void 0 ? parrelelTasks : null,
51
+ maxRetriesOnFailure,
52
+ rerunTestsNTimes,
53
+ cachedTestRunResults,
54
+ githubSummary,
55
+ maxSemanticVersionSupported: 1,
56
+ });
57
+ if (testRun.status === "Failure") {
58
+ process.exit(1);
59
+ }
60
+ }
61
+ catch (error) {
62
+ if ((0, out_of_date_client_error_1.isOutOfDateClientError)(error)) {
63
+ throw new out_of_date_client_error_1.OutOfDateCLIError();
64
+ }
65
+ else {
66
+ throw error;
67
+ }
56
68
  }
57
69
  };
58
70
  exports.runAllTestsCommand = (0, command_builder_1.buildCommand)("run-all-tests")
@@ -0,0 +1,5 @@
1
+ import { OutOfDateClientError } from "@alwaysmeticulous/sdk-bundles-api";
2
+ export declare const isOutOfDateClientError: (error: unknown) => error is OutOfDateClientError;
3
+ export declare class OutOfDateCLIError extends Error {
4
+ constructor();
5
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OutOfDateCLIError = exports.isOutOfDateClientError = void 0;
4
+ const isOutOfDateClientError = (error) => {
5
+ return error.name === "OutOfDateClient";
6
+ };
7
+ exports.isOutOfDateClientError = isOutOfDateClientError;
8
+ class OutOfDateCLIError extends Error {
9
+ constructor() {
10
+ super("The version of @alwaysmeticulous/cli you are using is out of date. Please update to the latest version, using npm or yarn, and try again.");
11
+ this.name = "OutOfDateCLI";
12
+ }
13
+ }
14
+ exports.OutOfDateCLIError = OutOfDateCLIError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alwaysmeticulous/cli",
3
- "version": "2.42.0",
3
+ "version": "2.42.1",
4
4
  "description": "The Meticulous CLI",
5
5
  "license": "ISC",
6
6
  "main": "dist/index.js",
@@ -33,8 +33,8 @@
33
33
  "@alwaysmeticulous/downloading-helpers": "^2.42.0",
34
34
  "@alwaysmeticulous/record": "^2.42.0",
35
35
  "@alwaysmeticulous/replay-debugger-ui": "^2.42.0",
36
- "@alwaysmeticulous/replay-orchestrator": "^2.42.0",
37
- "@alwaysmeticulous/sdk-bundles-api": "^2.42.0",
36
+ "@alwaysmeticulous/replay-orchestrator": "^2.42.1",
37
+ "@alwaysmeticulous/sdk-bundles-api": "^2.42.1",
38
38
  "@alwaysmeticulous/sentry": "^2.40.0",
39
39
  "@sentry/node": "^7.36.0",
40
40
  "axios": "^1.2.6",
@@ -79,5 +79,5 @@
79
79
  "coverageDirectory": "../coverage",
80
80
  "testEnvironment": "node"
81
81
  },
82
- "gitHead": "65e2410a784642674ea6c8203d5b9f8a303c33ea"
82
+ "gitHead": "6c08f6e79f34f7efdc2ebd0e8e4e09baffeb8f04"
83
83
  }