@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.
- package/dist/api/test-run.api.d.ts +3 -31
- package/dist/api/test-run.api.js +3 -96
- package/dist/commands/download-replay/download-replay.command.js +4 -4
- package/dist/commands/download-session/download-session.command.js +4 -4
- package/dist/commands/record/record.command.js +8 -11
- package/dist/commands/replay/replay.command.d.ts +4 -20
- package/dist/commands/replay/replay.command.js +4 -239
- package/dist/commands/run-all-tests/run-all-tests.command.js +5 -6
- package/dist/commands/show-project/show-project.command.js +2 -3
- package/dist/index.d.ts +0 -7
- package/dist/index.js +1 -13
- package/dist/main.js +5 -11
- package/dist/utils/sentry.utils.d.ts +0 -4
- package/dist/utils/sentry.utils.js +3 -23
- package/package.json +14 -32
- package/dist/api/client.d.ts +0 -5
- package/dist/api/client.js +0 -32
- package/dist/api/download.d.ts +0 -1
- package/dist/api/download.js +0 -21
- package/dist/api/project.api.d.ts +0 -3
- package/dist/api/project.api.js +0 -22
- package/dist/api/replay-diff.api.d.ts +0 -13
- package/dist/api/replay-diff.api.js +0 -32
- package/dist/api/replay.api.d.ts +0 -36
- package/dist/api/replay.api.js +0 -89
- package/dist/api/session.api.d.ts +0 -6
- package/dist/api/session.api.js +0 -45
- package/dist/api/types.d.ts +0 -39
- package/dist/api/types.js +0 -2
- package/dist/api/upload.d.ts +0 -1
- package/dist/api/upload.js +0 -18
- package/dist/archive/archive.d.ts +0 -4
- package/dist/archive/archive.js +0 -64
- package/dist/command-utils/common-types.d.ts +0 -20
- package/dist/command-utils/common-types.js +0 -2
- package/dist/commands/bootstrap/bootstrap.command.d.ts +0 -2
- package/dist/commands/bootstrap/bootstrap.command.js +0 -33
- package/dist/commands/create-test/create-test.command.d.ts +0 -94
- package/dist/commands/create-test/create-test.command.js +0 -170
- package/dist/commands/replay/utils/compute-diff.d.ts +0 -13
- package/dist/commands/replay/utils/compute-diff.js +0 -95
- package/dist/commands/replay/utils/exit-early-if-skip-upload-env-var-set.d.ts +0 -1
- package/dist/commands/replay/utils/exit-early-if-skip-upload-env-var-set.js +0 -27
- package/dist/commands/screenshot-diff/screenshot-diff.command.d.ts +0 -53
- package/dist/commands/screenshot-diff/screenshot-diff.command.js +0 -182
- package/dist/commands/screenshot-diff/utils/get-screenshot-filename.d.ts +0 -2
- package/dist/commands/screenshot-diff/utils/get-screenshot-filename.js +0 -18
- package/dist/commands/screenshot-diff/utils/get-screenshot-identifier.d.ts +0 -2
- package/dist/commands/screenshot-diff/utils/get-screenshot-identifier.js +0 -24
- package/dist/commands/screenshot-diff/utils/has-notable-differences.d.ts +0 -2
- package/dist/commands/screenshot-diff/utils/has-notable-differences.js +0 -10
- package/dist/commands/serve/serve.command.d.ts +0 -10
- package/dist/commands/serve/serve.command.js +0 -31
- package/dist/commands/update-tests/update-tests.command.d.ts +0 -21
- package/dist/commands/update-tests/update-tests.command.js +0 -96
- package/dist/config/config.d.ts +0 -3
- package/dist/config/config.js +0 -70
- package/dist/config/config.types.d.ts +0 -16
- package/dist/config/config.types.js +0 -2
- package/dist/config/snippets.d.ts +0 -1
- package/dist/config/snippets.js +0 -18
- package/dist/errors/config.d.ts +0 -3
- package/dist/errors/config.js +0 -10
- package/dist/image/diff.utils.d.ts +0 -19
- package/dist/image/diff.utils.js +0 -25
- package/dist/image/io.utils.d.ts +0 -3
- package/dist/image/io.utils.js +0 -25
- package/dist/local-data/local-data.utils.d.ts +0 -20
- package/dist/local-data/local-data.utils.js +0 -92
- package/dist/local-data/replay-assets.d.ts +0 -3
- package/dist/local-data/replay-assets.js +0 -94
- package/dist/local-data/replays.d.ts +0 -18
- package/dist/local-data/replays.js +0 -87
- package/dist/local-data/screenshot-diffs.d.ts +0 -7
- package/dist/local-data/screenshot-diffs.js +0 -20
- package/dist/local-data/serve-assets-from-simulation.d.ts +0 -5
- package/dist/local-data/serve-assets-from-simulation.js +0 -52
- package/dist/local-data/sessions.d.ts +0 -10
- package/dist/local-data/sessions.js +0 -41
- package/dist/parallel-tests/__tests__/merge-test-results.spec.d.ts +0 -1
- package/dist/parallel-tests/__tests__/merge-test-results.spec.js +0 -104
- package/dist/parallel-tests/__tests__/mock-test-results.d.ts +0 -17
- package/dist/parallel-tests/__tests__/mock-test-results.js +0 -106
- package/dist/parallel-tests/__tests__/parrallel-tests.handler.spec.d.ts +0 -1
- package/dist/parallel-tests/__tests__/parrallel-tests.handler.spec.js +0 -205
- package/dist/parallel-tests/execute-test-in-child-process.d.ts +0 -3
- package/dist/parallel-tests/execute-test-in-child-process.js +0 -44
- package/dist/parallel-tests/merge-test-results.d.ts +0 -12
- package/dist/parallel-tests/merge-test-results.js +0 -122
- package/dist/parallel-tests/messages.types.d.ts +0 -17
- package/dist/parallel-tests/messages.types.js +0 -2
- package/dist/parallel-tests/parallel-replay.handler.d.ts +0 -3
- package/dist/parallel-tests/parallel-replay.handler.js +0 -57
- package/dist/parallel-tests/parallel-replay.types.d.ts +0 -16
- package/dist/parallel-tests/parallel-replay.types.js +0 -2
- package/dist/parallel-tests/parallel-tests.handler.d.ts +0 -14
- package/dist/parallel-tests/parallel-tests.handler.js +0 -194
- package/dist/parallel-tests/run-all-tests.d.ts +0 -73
- package/dist/parallel-tests/run-all-tests.js +0 -237
- package/dist/parallel-tests/run-all-tests.types.d.ts +0 -6
- package/dist/parallel-tests/run-all-tests.types.js +0 -2
- package/dist/parallel-tests/screenshot-diff-results.utils.d.ts +0 -7
- package/dist/parallel-tests/screenshot-diff-results.utils.js +0 -20
- package/dist/parallel-tests/task.handler.d.ts +0 -1
- package/dist/parallel-tests/task.handler.js +0 -86
- package/dist/utils/api-token.utils.d.ts +0 -1
- package/dist/utils/api-token.utils.js +0 -31
- package/dist/utils/commit-sha.utils.d.ts +0 -1
- package/dist/utils/commit-sha.utils.js +0 -42
- package/dist/utils/config.utils.d.ts +0 -7
- package/dist/utils/config.utils.js +0 -33
- package/dist/utils/github-summary.utils.d.ts +0 -5
- package/dist/utils/github-summary.utils.js +0 -38
- package/dist/utils/run-all-tests.utils.d.ts +0 -16
- package/dist/utils/run-all-tests.utils.js +0 -32
- package/dist/utils/test-run-environment.utils.d.ts +0 -2
- package/dist/utils/test-run-environment.utils.js +0 -25
- package/dist/utils/version.utils.d.ts +0 -1
- 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,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,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;
|