@alwaysmeticulous/cli 2.45.2 → 2.46.0

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.
@@ -1,21 +1,5 @@
1
1
  /// <reference types="yargs" />
2
- import { Replay, ScreenshotDiffOptions } from "@alwaysmeticulous/api";
3
- import { ReplayExecutionOptions, ReplayTarget } from "@alwaysmeticulous/sdk-bundles-api";
4
- export interface RawReplayCommandHandlerOptions extends ScreenshotDiffOptions, Omit<ReplayExecutionOptions, "maxDurationMs" | "maxEventCount"> {
5
- screenshot: boolean;
6
- appUrl: string | null | undefined;
7
- simulationIdForAssets: string | null | undefined;
8
- maxDurationMs: number | null | undefined;
9
- maxEventCount: number | null | undefined;
10
- storyboard: boolean;
11
- apiToken: string | null | undefined;
12
- commitSha: string | null | undefined;
13
- sessionId: string;
14
- cookiesFile: string | null | undefined;
15
- debugger: boolean;
16
- baseReplayId: string | null | undefined;
17
- }
18
- export declare const rawReplayCommandHandler: ({ 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, }: RawReplayCommandHandlerOptions) => Promise<Replay>;
2
+ import { ReplayTarget } from "@alwaysmeticulous/sdk-bundles-api";
19
3
  export declare const getReplayTarget: ({ appUrl, simulationIdForAssets, }: {
20
4
  appUrl: string | null;
21
5
  simulationIdForAssets: string | null;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.replayCommand = exports.getReplayTarget = exports.rawReplayCommandHandler = void 0;
3
+ exports.replayCommand = exports.getReplayTarget = void 0;
4
4
  const common_1 = require("@alwaysmeticulous/common");
5
5
  const replay_orchestrator_launcher_1 = require("@alwaysmeticulous/replay-orchestrator-launcher");
6
6
  const command_builder_1 = require("../../command-utils/command-builder");
7
7
  const common_options_1 = require("../../command-utils/common-options");
8
8
  const out_of_date_client_error_1 = require("../../utils/out-of-date-client-error");
9
9
  const replay_debugger_ui_1 = require("./utils/replay-debugger.ui");
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
+ const replayCommandHandler = 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, }) => {
11
11
  if (!screenshot && storyboard) {
12
12
  throw new Error("Cannot take storyboard screenshots without taking end state screenshots. Please set '--screenshot' to true, or '--storyboard' to false.");
13
13
  }
@@ -81,8 +81,7 @@ const rawReplayCommandHandler = async ({ apiToken, commitSha, sessionId, appUrl,
81
81
  getOnBeforeUserEventCallback.resolve(stepThroughDebuggerUI.onBeforeUserEvent);
82
82
  getOnClosePageCallback.resolve(stepThroughDebuggerUI.close);
83
83
  }
84
- const { replay } = await replayExecution.finalResult;
85
- return replay;
84
+ await replayExecution.finalResult;
86
85
  }
87
86
  catch (error) {
88
87
  if ((0, out_of_date_client_error_1.isOutOfDateClientError)(error)) {
@@ -93,7 +92,6 @@ const rawReplayCommandHandler = async ({ apiToken, commitSha, sessionId, appUrl,
93
92
  }
94
93
  }
95
94
  };
96
- exports.rawReplayCommandHandler = rawReplayCommandHandler;
97
95
  const getReplayTarget = ({ appUrl, simulationIdForAssets, }) => {
98
96
  if (simulationIdForAssets) {
99
97
  return { type: "snapshotted-assets", simulationIdForAssets };
@@ -149,5 +147,5 @@ exports.replayCommand = (0, command_builder_1.buildCommand)("simulate")
149
147
  ...common_options_1.SCREENSHOT_DIFF_OPTIONS,
150
148
  })
151
149
  .handler(async (options) => {
152
- await (0, exports.rawReplayCommandHandler)(options);
150
+ await replayCommandHandler(options);
153
151
  });
@@ -107,11 +107,6 @@ export declare const runAllTestsCommand: import("yargs").CommandModule<unknown,
107
107
  readonly description: "If set to a value greater than 0 then will re-run all replays the specified number of times and mark them as a flake if the screenshot generated on one of the retryed replays differs from that in the first replay.";
108
108
  readonly default: 0;
109
109
  };
110
- readonly useCache: {
111
- readonly boolean: true;
112
- readonly description: "Use result cache";
113
- readonly default: false;
114
- };
115
110
  readonly testsFile: {
116
111
  readonly string: true;
117
112
  readonly description: string;
@@ -1,14 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runAllTestsCommand = void 0;
4
- const client_1 = require("@alwaysmeticulous/client");
5
4
  const common_1 = require("@alwaysmeticulous/common");
6
5
  const replay_orchestrator_launcher_1 = require("@alwaysmeticulous/replay-orchestrator-launcher");
7
- const test_run_api_1 = require("../../api/test-run.api");
8
6
  const command_builder_1 = require("../../command-utils/command-builder");
9
7
  const common_options_1 = require("../../command-utils/common-options");
10
8
  const out_of_date_client_error_1 = require("../../utils/out-of-date-client-error");
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, }) => {
9
+ const handler = async ({ apiToken, commitSha: commitSha_, baseCommitSha, appUrl, headless, devTools, bypassCSP, diffThreshold, diffPixelThreshold, shiftTime, networkStubbing, githubSummary, parallelize, parallelTasks: parrelelTasks_, maxRetriesOnFailure, rerunTestsNTimes, testsFile, disableRemoteFonts, noSandbox, skipPauses, moveBeforeClick, maxDurationMs, maxEventCount, storyboard, essentialFeaturesOnly, baseTestRunId, }) => {
12
10
  const executionOptions = {
13
11
  headless,
14
12
  devTools,
@@ -33,10 +31,6 @@ const handler = async ({ apiToken, commitSha: commitSha_, baseCommitSha, appUrl,
33
31
  };
34
32
  const parrelelTasks = parallelize ? parrelelTasks_ : 1;
35
33
  const commitSha = (await (0, common_1.getCommitSha)(commitSha_)) || "unknown";
36
- const client = (0, client_1.createClient)({ apiToken });
37
- const cachedTestRunResults = useCache
38
- ? await (0, test_run_api_1.getCachedTestRunResults)({ client, commitSha })
39
- : [];
40
34
  try {
41
35
  const { testRun } = await (0, replay_orchestrator_launcher_1.executeTestRun)({
42
36
  testsFile: testsFile !== null && testsFile !== void 0 ? testsFile : null,
@@ -50,7 +44,6 @@ const handler = async ({ apiToken, commitSha: commitSha_, baseCommitSha, appUrl,
50
44
  parallelTasks: parrelelTasks !== null && parrelelTasks !== void 0 ? parrelelTasks : null,
51
45
  maxRetriesOnFailure,
52
46
  rerunTestsNTimes,
53
- cachedTestRunResults,
54
47
  githubSummary,
55
48
  maxSemanticVersionSupported: 1,
56
49
  });
@@ -110,11 +103,6 @@ exports.runAllTestsCommand = (0, command_builder_1.buildCommand)("run-all-tests"
110
103
  description: "If set to a value greater than 0 then will re-run all replays the specified number of times and mark them as a flake if the screenshot generated on one of the retryed replays differs from that in the first replay.",
111
104
  default: 0,
112
105
  },
113
- useCache: {
114
- boolean: true,
115
- description: "Use result cache",
116
- default: false,
117
- },
118
106
  testsFile: {
119
107
  string: true,
120
108
  description: "The path to the meticulous.json file containing the list of tests you want to run." +
@@ -38,13 +38,17 @@ exports.setOptions = setOptions;
38
38
  const wrapHandler = function wrapHandler_(handler) {
39
39
  return async (args) => {
40
40
  await handler(args)
41
- .then(() => {
41
+ .then(async () => {
42
42
  var _a;
43
43
  const transaction = (_a = Sentry.getCurrentHub().getScope()) === null || _a === void 0 ? void 0 : _a.getTransaction();
44
44
  if (transaction !== undefined) {
45
45
  transaction.setStatus("ok");
46
46
  transaction.finish();
47
47
  }
48
+ await Sentry.flush(sentry_1.SENTRY_FLUSH_TIMEOUT.toMillis());
49
+ // This is required: otherwise the process will hang for a while,
50
+ // presumably waiting on some setTimeout to trigger
51
+ process.exit(0);
48
52
  })
49
53
  .catch(async (error) => {
50
54
  var _a;
@@ -54,6 +58,7 @@ const wrapHandler = function wrapHandler_(handler) {
54
58
  transaction.setStatus("unknown_error");
55
59
  transaction.finish();
56
60
  }
61
+ await Sentry.flush(sentry_1.SENTRY_FLUSH_TIMEOUT.toMillis());
57
62
  // Don't display the help text which can obscure the error
58
63
  process.exit(1);
59
64
  });
@@ -67,5 +72,4 @@ const reportHandlerError = async (error) => {
67
72
  logger.info("");
68
73
  logger.info("Tip: run `meticulous <command> --help` for help on a particular command, or `meticulous --help` for a list of the available commands.");
69
74
  Sentry.captureException(error);
70
- await Sentry.flush(sentry_1.SENTRY_FLUSH_TIMEOUT.toMillis());
71
75
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alwaysmeticulous/cli",
3
- "version": "2.45.2",
3
+ "version": "2.46.0",
4
4
  "description": "The Meticulous CLI",
5
5
  "license": "ISC",
6
6
  "main": "dist/index.js",
@@ -27,17 +27,16 @@
27
27
  "depcheck": "depcheck --ignore-patterns=dist"
28
28
  },
29
29
  "dependencies": {
30
- "@alwaysmeticulous/api": "^2.44.1",
31
- "@alwaysmeticulous/client": "^2.44.1",
32
- "@alwaysmeticulous/common": "^2.44.1",
33
- "@alwaysmeticulous/downloading-helpers": "^2.44.1",
34
- "@alwaysmeticulous/record": "^2.44.1",
35
- "@alwaysmeticulous/replay-debugger-ui": "^2.45.2",
36
- "@alwaysmeticulous/replay-orchestrator-launcher": "^2.45.0",
37
- "@alwaysmeticulous/sdk-bundles-api": "^2.45.0",
30
+ "@alwaysmeticulous/api": "^2.46.0",
31
+ "@alwaysmeticulous/client": "^2.46.0",
32
+ "@alwaysmeticulous/common": "^2.46.0",
33
+ "@alwaysmeticulous/downloading-helpers": "^2.46.0",
34
+ "@alwaysmeticulous/record": "^2.46.0",
35
+ "@alwaysmeticulous/replay-debugger-ui": "^2.46.0",
36
+ "@alwaysmeticulous/replay-orchestrator-launcher": "^2.46.0",
37
+ "@alwaysmeticulous/sdk-bundles-api": "^2.46.0",
38
38
  "@alwaysmeticulous/sentry": "^2.40.0",
39
39
  "@sentry/node": "^7.36.0",
40
- "axios": "^1.2.6",
41
40
  "loglevel": "^1.8.0",
42
41
  "puppeteer": "19.7.5",
43
42
  "yargs": "^17.5.1"
@@ -79,5 +78,5 @@
79
78
  "coverageDirectory": "../coverage",
80
79
  "testEnvironment": "node"
81
80
  },
82
- "gitHead": "3093e2cc8552f2821bac908b98a5be7316bc98b2"
81
+ "gitHead": "c03e5e034eb89d79d16f0eee09f95fa58341e038"
83
82
  }
@@ -1,7 +0,0 @@
1
- import { TestCaseResult } from "@alwaysmeticulous/api";
2
- import { AxiosInstance } from "axios";
3
- export interface GetCachedTestRunResultsOptions {
4
- client: AxiosInstance;
5
- commitSha: string;
6
- }
7
- export declare const getCachedTestRunResults: ({ client, commitSha, }: GetCachedTestRunResultsOptions) => Promise<TestCaseResult[]>;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getCachedTestRunResults = void 0;
7
- const client_1 = require("@alwaysmeticulous/client");
8
- const common_1 = require("@alwaysmeticulous/common");
9
- const loglevel_1 = __importDefault(require("loglevel"));
10
- const getCachedTestRunResults = async ({ client, commitSha, }) => {
11
- var _a, _b, _c;
12
- const logger = loglevel_1.default.getLogger(common_1.METICULOUS_LOGGER_NAME);
13
- if (!commitSha || commitSha === "unknown") {
14
- logger.warn("Test run cache not supported: no commit hash");
15
- return [];
16
- }
17
- const results = (_c = (_b = (_a = (await (0, client_1.getLatestTestRunResults)({ client, commitSha }))) === null || _a === void 0 ? void 0 : _a.resultData) === null || _b === void 0 ? void 0 : _b.results) !== null && _c !== void 0 ? _c : [];
18
- // Only return passing tests
19
- return results.filter(({ result }) => result === "pass");
20
- };
21
- exports.getCachedTestRunResults = getCachedTestRunResults;