@alwaysmeticulous/cli 2.39.0 → 2.40.4

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.
Files changed (119) hide show
  1. package/dist/api/test-run.api.d.ts +3 -31
  2. package/dist/api/test-run.api.js +3 -96
  3. package/dist/commands/download-replay/download-replay.command.js +4 -4
  4. package/dist/commands/download-session/download-session.command.js +4 -4
  5. package/dist/commands/record/record.command.js +8 -11
  6. package/dist/commands/replay/replay.command.d.ts +4 -20
  7. package/dist/commands/replay/replay.command.js +4 -239
  8. package/dist/commands/run-all-tests/run-all-tests.command.js +5 -6
  9. package/dist/commands/show-project/show-project.command.js +2 -3
  10. package/dist/index.d.ts +0 -7
  11. package/dist/index.js +1 -13
  12. package/dist/main.js +5 -11
  13. package/dist/utils/sentry.utils.d.ts +0 -4
  14. package/dist/utils/sentry.utils.js +3 -23
  15. package/package.json +14 -32
  16. package/dist/api/client.d.ts +0 -5
  17. package/dist/api/client.js +0 -32
  18. package/dist/api/download.d.ts +0 -1
  19. package/dist/api/download.js +0 -21
  20. package/dist/api/project.api.d.ts +0 -3
  21. package/dist/api/project.api.js +0 -22
  22. package/dist/api/replay-diff.api.d.ts +0 -13
  23. package/dist/api/replay-diff.api.js +0 -32
  24. package/dist/api/replay.api.d.ts +0 -36
  25. package/dist/api/replay.api.js +0 -89
  26. package/dist/api/session.api.d.ts +0 -6
  27. package/dist/api/session.api.js +0 -45
  28. package/dist/api/types.d.ts +0 -39
  29. package/dist/api/types.js +0 -2
  30. package/dist/api/upload.d.ts +0 -1
  31. package/dist/api/upload.js +0 -18
  32. package/dist/archive/archive.d.ts +0 -4
  33. package/dist/archive/archive.js +0 -64
  34. package/dist/command-utils/common-types.d.ts +0 -20
  35. package/dist/command-utils/common-types.js +0 -2
  36. package/dist/commands/bootstrap/bootstrap.command.d.ts +0 -2
  37. package/dist/commands/bootstrap/bootstrap.command.js +0 -33
  38. package/dist/commands/create-test/create-test.command.d.ts +0 -94
  39. package/dist/commands/create-test/create-test.command.js +0 -170
  40. package/dist/commands/replay/utils/compute-diff.d.ts +0 -13
  41. package/dist/commands/replay/utils/compute-diff.js +0 -95
  42. package/dist/commands/replay/utils/exit-early-if-skip-upload-env-var-set.d.ts +0 -1
  43. package/dist/commands/replay/utils/exit-early-if-skip-upload-env-var-set.js +0 -27
  44. package/dist/commands/screenshot-diff/screenshot-diff.command.d.ts +0 -53
  45. package/dist/commands/screenshot-diff/screenshot-diff.command.js +0 -182
  46. package/dist/commands/screenshot-diff/utils/get-screenshot-filename.d.ts +0 -2
  47. package/dist/commands/screenshot-diff/utils/get-screenshot-filename.js +0 -18
  48. package/dist/commands/screenshot-diff/utils/get-screenshot-identifier.d.ts +0 -2
  49. package/dist/commands/screenshot-diff/utils/get-screenshot-identifier.js +0 -24
  50. package/dist/commands/screenshot-diff/utils/has-notable-differences.d.ts +0 -2
  51. package/dist/commands/screenshot-diff/utils/has-notable-differences.js +0 -10
  52. package/dist/commands/serve/serve.command.d.ts +0 -10
  53. package/dist/commands/serve/serve.command.js +0 -31
  54. package/dist/commands/update-tests/update-tests.command.d.ts +0 -21
  55. package/dist/commands/update-tests/update-tests.command.js +0 -96
  56. package/dist/config/config.d.ts +0 -3
  57. package/dist/config/config.js +0 -70
  58. package/dist/config/config.types.d.ts +0 -16
  59. package/dist/config/config.types.js +0 -2
  60. package/dist/config/snippets.d.ts +0 -1
  61. package/dist/config/snippets.js +0 -18
  62. package/dist/errors/config.d.ts +0 -3
  63. package/dist/errors/config.js +0 -10
  64. package/dist/image/diff.utils.d.ts +0 -19
  65. package/dist/image/diff.utils.js +0 -25
  66. package/dist/image/io.utils.d.ts +0 -3
  67. package/dist/image/io.utils.js +0 -25
  68. package/dist/local-data/local-data.utils.d.ts +0 -20
  69. package/dist/local-data/local-data.utils.js +0 -92
  70. package/dist/local-data/replay-assets.d.ts +0 -3
  71. package/dist/local-data/replay-assets.js +0 -94
  72. package/dist/local-data/replays.d.ts +0 -18
  73. package/dist/local-data/replays.js +0 -87
  74. package/dist/local-data/screenshot-diffs.d.ts +0 -7
  75. package/dist/local-data/screenshot-diffs.js +0 -20
  76. package/dist/local-data/serve-assets-from-simulation.d.ts +0 -5
  77. package/dist/local-data/serve-assets-from-simulation.js +0 -52
  78. package/dist/local-data/sessions.d.ts +0 -10
  79. package/dist/local-data/sessions.js +0 -41
  80. package/dist/parallel-tests/__tests__/merge-test-results.spec.d.ts +0 -1
  81. package/dist/parallel-tests/__tests__/merge-test-results.spec.js +0 -104
  82. package/dist/parallel-tests/__tests__/mock-test-results.d.ts +0 -17
  83. package/dist/parallel-tests/__tests__/mock-test-results.js +0 -106
  84. package/dist/parallel-tests/__tests__/parrallel-tests.handler.spec.d.ts +0 -1
  85. package/dist/parallel-tests/__tests__/parrallel-tests.handler.spec.js +0 -205
  86. package/dist/parallel-tests/execute-test-in-child-process.d.ts +0 -3
  87. package/dist/parallel-tests/execute-test-in-child-process.js +0 -44
  88. package/dist/parallel-tests/merge-test-results.d.ts +0 -12
  89. package/dist/parallel-tests/merge-test-results.js +0 -122
  90. package/dist/parallel-tests/messages.types.d.ts +0 -17
  91. package/dist/parallel-tests/messages.types.js +0 -2
  92. package/dist/parallel-tests/parallel-replay.handler.d.ts +0 -3
  93. package/dist/parallel-tests/parallel-replay.handler.js +0 -57
  94. package/dist/parallel-tests/parallel-replay.types.d.ts +0 -16
  95. package/dist/parallel-tests/parallel-replay.types.js +0 -2
  96. package/dist/parallel-tests/parallel-tests.handler.d.ts +0 -14
  97. package/dist/parallel-tests/parallel-tests.handler.js +0 -194
  98. package/dist/parallel-tests/run-all-tests.d.ts +0 -73
  99. package/dist/parallel-tests/run-all-tests.js +0 -237
  100. package/dist/parallel-tests/run-all-tests.types.d.ts +0 -6
  101. package/dist/parallel-tests/run-all-tests.types.js +0 -2
  102. package/dist/parallel-tests/screenshot-diff-results.utils.d.ts +0 -7
  103. package/dist/parallel-tests/screenshot-diff-results.utils.js +0 -20
  104. package/dist/parallel-tests/task.handler.d.ts +0 -1
  105. package/dist/parallel-tests/task.handler.js +0 -86
  106. package/dist/utils/api-token.utils.d.ts +0 -1
  107. package/dist/utils/api-token.utils.js +0 -31
  108. package/dist/utils/commit-sha.utils.d.ts +0 -1
  109. package/dist/utils/commit-sha.utils.js +0 -42
  110. package/dist/utils/config.utils.d.ts +0 -7
  111. package/dist/utils/config.utils.js +0 -33
  112. package/dist/utils/github-summary.utils.d.ts +0 -5
  113. package/dist/utils/github-summary.utils.js +0 -38
  114. package/dist/utils/run-all-tests.utils.d.ts +0 -16
  115. package/dist/utils/run-all-tests.utils.js +0 -32
  116. package/dist/utils/test-run-environment.utils.d.ts +0 -2
  117. package/dist/utils/test-run-environment.utils.js +0 -25
  118. package/dist/utils/version.utils.d.ts +0 -1
  119. package/dist/utils/version.utils.js +0 -17
@@ -1,42 +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.getCommitSha = void 0;
7
- const child_process_1 = require("child_process");
8
- const common_1 = require("@alwaysmeticulous/common");
9
- const loglevel_1 = __importDefault(require("loglevel"));
10
- const getGitRevParseHead = () => {
11
- return new Promise((resolve, reject) => {
12
- (0, child_process_1.exec)("git rev-parse HEAD", { encoding: "utf-8" }, (error, output) => {
13
- if (error) {
14
- reject(error);
15
- return;
16
- }
17
- resolve(output);
18
- });
19
- });
20
- };
21
- const getCommitSha = async (commitSha_) => {
22
- if (commitSha_) {
23
- return commitSha_;
24
- }
25
- const logger = loglevel_1.default.getLogger(common_1.METICULOUS_LOGGER_NAME);
26
- try {
27
- const gitCommitSha = (await getGitRevParseHead()).trim();
28
- return gitCommitSha;
29
- }
30
- catch (error) {
31
- // Suppress error logging if not in a git repository
32
- if (error instanceof Error) {
33
- if (error.message.startsWith("Command failed")) {
34
- logger.info("Notice: not running in a git repository");
35
- return "";
36
- }
37
- }
38
- logger.error(error);
39
- return "";
40
- }
41
- };
42
- exports.getCommitSha = getCommitSha;
@@ -1,7 +0,0 @@
1
- import { TestCase } from "@alwaysmeticulous/api";
2
- import { ReplayTarget } from "@alwaysmeticulous/common/dist/types/replay.types";
3
- export declare const addTestCase: (testCase: TestCase) => Promise<void>;
4
- export declare const getReplayTargetForTestCase: ({ appUrl, testCase, }: {
5
- appUrl: string | null;
6
- testCase: TestCase;
7
- }) => ReplayTarget;
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getReplayTargetForTestCase = exports.addTestCase = void 0;
4
- const config_1 = require("../config/config");
5
- const addTestCase = async (testCase) => {
6
- const meticulousConfig = await (0, config_1.readConfig)();
7
- const newConfig = {
8
- ...meticulousConfig,
9
- testCases: [...(meticulousConfig.testCases || []), testCase],
10
- };
11
- await (0, config_1.saveConfig)(newConfig);
12
- };
13
- exports.addTestCase = addTestCase;
14
- const getReplayTargetForTestCase = ({ appUrl, testCase, }) => {
15
- var _a, _b, _c;
16
- if (((_a = testCase.options) === null || _a === void 0 ? void 0 : _a.simulationIdForAssets) != null) {
17
- return {
18
- type: "snapshotted-assets",
19
- simulationIdForAssets: (_b = testCase.options) === null || _b === void 0 ? void 0 : _b.simulationIdForAssets,
20
- };
21
- }
22
- if ((_c = testCase.options) === null || _c === void 0 ? void 0 : _c.appUrl) {
23
- if (appUrl) {
24
- throw new Error(`Test cases "${testCase.title}" has an "appUrl" option but --appUrl is also provided.`);
25
- }
26
- return { type: "url", appUrl: testCase.options.appUrl };
27
- }
28
- if (appUrl) {
29
- return { type: "url", appUrl };
30
- }
31
- return { type: "original-recorded-url" };
32
- };
33
- exports.getReplayTargetForTestCase = getReplayTargetForTestCase;
@@ -1,5 +0,0 @@
1
- import { TestCaseResult } from "../config/config.types";
2
- export declare const writeGitHubSummary: (options: {
3
- testRunUrl: string;
4
- results: TestCaseResult[];
5
- }) => Promise<void>;
@@ -1,38 +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.writeGitHubSummary = void 0;
7
- const promises_1 = require("fs/promises");
8
- const common_1 = require("@alwaysmeticulous/common");
9
- const loglevel_1 = __importDefault(require("loglevel"));
10
- const writeGitHubSummary = async ({ testRunUrl, results }) => {
11
- const logger = loglevel_1.default.getLogger(common_1.METICULOUS_LOGGER_NAME);
12
- const summaryFile = process.env["GITHUB_STEP_SUMMARY"] || "";
13
- if (!summaryFile) {
14
- logger.warn("Warning: $GITHUB_STEP_SUMMARY is not defined, skipping writing GitHub action summary");
15
- return;
16
- }
17
- const summary = `# Test Results
18
-
19
- [View on Meticulous](${testRunUrl})
20
-
21
- <table>
22
- <thead>
23
- <th>Result</th>
24
- <th>Test Case</th>
25
- </thead>
26
- <tbody>
27
- ${results
28
- .map(({ title, result }) => `<tr>
29
- <td>${result === "pass" ? "✅️" : "❌️"}</td>
30
- <td>${title}</td>
31
- </tr>`)
32
- .join("\n")}
33
- </tbody>
34
- </table>
35
- `;
36
- await (0, promises_1.appendFile)(summaryFile, summary, "utf-8");
37
- };
38
- exports.writeGitHubSummary = writeGitHubSummary;
@@ -1,16 +0,0 @@
1
- import { TestCase } from "@alwaysmeticulous/api";
2
- import { AxiosInstance } from "axios";
3
- import { DetailedTestCaseResult } from "../config/config.types";
4
- export declare const mergeTestCases: (...testSuites: (TestCase[] | null | undefined)[]) => TestCase[];
5
- export declare const sortResults: (options: {
6
- results: DetailedTestCaseResult[];
7
- testCases: TestCase[];
8
- }) => DetailedTestCaseResult[];
9
- export interface GetTestsToRunOptions {
10
- client: AxiosInstance;
11
- testCases: TestCase[];
12
- /**
13
- * The base commit to compare test results against for test cases that don't have a baseReplayId specified.
14
- */
15
- baseCommitSha: string | null;
16
- }
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sortResults = exports.mergeTestCases = void 0;
4
- const mergeTestCases = (...testSuites) => {
5
- const seenSessionIds = new Set();
6
- return testSuites.flatMap((testSuite) => {
7
- if (testSuite == null) {
8
- return [];
9
- }
10
- const newTestCases = testSuite.filter((testCase) => !seenSessionIds.has(testCase.sessionId));
11
- testSuite.forEach((testCase) => seenSessionIds.add(testCase.sessionId));
12
- return newTestCases;
13
- });
14
- };
15
- exports.mergeTestCases = mergeTestCases;
16
- const sortResults = ({ results: unsorted_, testCases }) => {
17
- const unsorted = [...unsorted_];
18
- const results = [];
19
- testCases.forEach(({ title, baseTestRunId, sessionId }) => {
20
- const idx = unsorted.findIndex((result) => result.title === title &&
21
- result.baseTestRunId === baseTestRunId &&
22
- result.sessionId === sessionId);
23
- if (idx == -1) {
24
- return;
25
- }
26
- results.push(unsorted[idx]);
27
- unsorted.splice(idx, 1);
28
- });
29
- results.push(...unsorted);
30
- return results;
31
- };
32
- exports.sortResults = sortResults;
@@ -1,2 +0,0 @@
1
- import { TestRunEnvironment } from "@alwaysmeticulous/api";
2
- export declare const getEnvironment: (environment?: TestRunEnvironment) => TestRunEnvironment;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getEnvironment = void 0;
4
- const getEnvironment = (environment) => {
5
- var _a;
6
- const ci = (_a = environment === null || environment === void 0 ? void 0 : environment.ci) !== null && _a !== void 0 ? _a : toBool(process.env["CI"]);
7
- return {
8
- ...environment,
9
- ci,
10
- };
11
- };
12
- exports.getEnvironment = getEnvironment;
13
- const toBool = (value) => {
14
- if (typeof value === "boolean") {
15
- return value;
16
- }
17
- if (typeof value === "number") {
18
- return !!value;
19
- }
20
- if (typeof value === "string") {
21
- const stringValue = value.trim().toLowerCase();
22
- return stringValue === "true" || !!+stringValue;
23
- }
24
- return false;
25
- };
@@ -1 +0,0 @@
1
- export declare const getMeticulousVersion: () => Promise<string>;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getMeticulousVersion = void 0;
4
- const promises_1 = require("fs/promises");
5
- const path_1 = require("path");
6
- let version = "";
7
- const getMeticulousVersion = async () => {
8
- if (version) {
9
- return version;
10
- }
11
- const packageJsonPath = (0, path_1.normalize)((0, path_1.join)(__dirname, "../../package.json"));
12
- const packageJson = JSON.parse(await (0, promises_1.readFile)(packageJsonPath, { encoding: "utf-8" }));
13
- const versionStr = packageJson["version"] || "unknown";
14
- version = `sdk-v${versionStr}`;
15
- return version;
16
- };
17
- exports.getMeticulousVersion = getMeticulousVersion;