happo 6.0.2 → 6.0.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/cli/{cancelJob-DLBVJJZD.js → cancelJob-GCTVJGYB.js} +3 -3
- package/dist/cli/{chunk-WCYGMV7Y.js → chunk-DYCU4INF.js} +2 -2
- package/dist/cli/{chunk-WCYGMV7Y.js.map → chunk-DYCU4INF.js.map} +1 -1
- package/dist/cli/{chunk-6EGFARRJ.js → chunk-TCHC2O3E.js} +2 -2
- package/dist/cli/{chunk-3DMZ3X42.js → chunk-TPF2272Y.js} +2 -2
- package/dist/cli/createAsyncComparison-5X5OBHF2.js +9 -0
- package/dist/cli/{createAsyncReport-NU2YZCLB.js → createAsyncReport-ZIO2Q6SS.js} +3 -3
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +65 -28
- package/dist/cli/index.js.map +2 -2
- package/dist/cli/package-CB7WD7JO.js +7 -0
- package/dist/cli/{prepareSnapRequests-YHIEO2TR.js → prepareSnapRequests-NPYZG2AI.js} +3 -3
- package/dist/cli/{startJob-GYFQMV2N.js → startJob-T3PWEYOP.js} +3 -3
- package/dist/cli/{wrapper-YF7XYZUE.js → wrapper-WKKUKM7T.js} +7 -5
- package/dist/cli/{wrapper-YF7XYZUE.js.map → wrapper-WKKUKM7T.js.map} +2 -2
- package/dist/config/loadConfig.d.ts +3 -1
- package/dist/config/loadConfig.d.ts.map +1 -1
- package/dist/cypress/task.js +55 -18
- package/dist/cypress/task.js.map +2 -2
- package/dist/e2e/wrapper.d.ts.map +1 -1
- package/dist/playwright/index.js +55 -18
- package/dist/playwright/index.js.map +2 -2
- package/dist/storybook/browser/register.d.ts.map +1 -1
- package/dist/storybook/browser/register.js +0 -13
- package/dist/storybook/browser/register.js.map +2 -2
- package/package.json +1 -1
- package/dist/cli/createAsyncComparison-6QN75552.js +0 -9
- package/dist/cli/package-XGP4W7OT.js +0 -7
- /package/dist/cli/{cancelJob-DLBVJJZD.js.map → cancelJob-GCTVJGYB.js.map} +0 -0
- /package/dist/cli/{chunk-6EGFARRJ.js.map → chunk-TCHC2O3E.js.map} +0 -0
- /package/dist/cli/{chunk-3DMZ3X42.js.map → chunk-TPF2272Y.js.map} +0 -0
- /package/dist/cli/{createAsyncComparison-6QN75552.js.map → createAsyncComparison-5X5OBHF2.js.map} +0 -0
- /package/dist/cli/{createAsyncReport-NU2YZCLB.js.map → createAsyncReport-ZIO2Q6SS.js.map} +0 -0
- /package/dist/cli/{package-XGP4W7OT.js.map → package-CB7WD7JO.js.map} +0 -0
- /package/dist/cli/{prepareSnapRequests-YHIEO2TR.js.map → prepareSnapRequests-NPYZG2AI.js.map} +0 -0
- /package/dist/cli/{startJob-GYFQMV2N.js.map → startJob-T3PWEYOP.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
makeHappoAPIRequest
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-TCHC2O3E.js";
|
|
4
|
+
import "./chunk-DYCU4INF.js";
|
|
5
5
|
|
|
6
6
|
// src/network/cancelJob.ts
|
|
7
7
|
async function cancelJob(status, config, { beforeSha, afterSha, link, message }, logger) {
|
|
@@ -24,4 +24,4 @@ async function cancelJob(status, config, { beforeSha, afterSha, link, message },
|
|
|
24
24
|
export {
|
|
25
25
|
cancelJob as default
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=cancelJob-
|
|
27
|
+
//# sourceMappingURL=cancelJob-GCTVJGYB.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "happo",
|
|
4
|
-
version: "6.0.
|
|
4
|
+
version: "6.0.4",
|
|
5
5
|
description: "Catch unexpected visual and accessibility changes and UI bugs",
|
|
6
6
|
license: "MIT",
|
|
7
7
|
repository: {
|
|
@@ -184,4 +184,4 @@ var package_default = {
|
|
|
184
184
|
export {
|
|
185
185
|
package_default
|
|
186
186
|
};
|
|
187
|
-
//# sourceMappingURL=chunk-
|
|
187
|
+
//# sourceMappingURL=chunk-DYCU4INF.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../package.json"],
|
|
4
|
-
"sourcesContent": ["{\n \"name\": \"happo\",\n \"version\": \"6.0.
|
|
4
|
+
"sourcesContent": ["{\n \"name\": \"happo\",\n \"version\": \"6.0.4\",\n \"description\": \"Catch unexpected visual and accessibility changes and UI bugs\",\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/happo/happo.git\"\n },\n \"bugs\": \"https://github.com/happo/happo/issues\",\n \"homepage\": \"https://happo.io\",\n \"bin\": {\n \"happo\": \"dist/cli/index.js\"\n },\n \"type\": \"module\",\n \"main\": \"./dist/config/index.js\",\n \"types\": \"./dist/config/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/config/index.d.ts\",\n \"default\": \"./dist/config/index.js\"\n },\n \"./cypress\": {\n \"types\": \"./dist/cypress/index.d.ts\",\n \"default\": \"./dist/cypress/index.js\"\n },\n \"./cypress/task\": {\n \"types\": \"./dist/cypress/task.d.ts\",\n \"default\": \"./dist/cypress/task.js\"\n },\n \"./playwright\": {\n \"types\": \"./dist/playwright/index.d.ts\",\n \"default\": \"./dist/playwright/index.js\"\n },\n \"./custom\": {\n \"types\": \"./dist/custom/index.d.ts\",\n \"default\": \"./dist/custom/index.js\"\n },\n \"./storybook/addon\": {\n \"types\": \"./dist/storybook/browser/addon.d.ts\",\n \"default\": \"./dist/storybook/browser/addon.js\"\n },\n \"./storybook/decorator\": {\n \"types\": \"./dist/storybook/browser/decorator.d.ts\",\n \"default\": \"./dist/storybook/browser/decorator.js\"\n },\n \"./storybook/preset\": {\n \"types\": \"./dist/storybook/preset.d.ts\",\n \"default\": \"./dist/storybook/preset.js\"\n },\n \"./storybook/register\": {\n \"types\": \"./dist/storybook/browser/register.d.ts\",\n \"default\": \"./dist/storybook/browser/register.js\"\n }\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"all\": \"node ./scripts/allchecks.ts\",\n \"build\": \"pnpm build:types && pnpm build:dist\",\n \"build:custom\": \"esbuild src/custom/__happo__/index.ts --bundle --format=iife --global-name=happoCustom --outfile=tmp/happo-custom/bundle.js --platform=browser --target=esnext\",\n \"build:dist\": \"./scripts/build.ts\",\n \"build:types\": \"pnpm tsc --pretty\",\n \"build:watch\": \"tsc --build --watch\",\n \"clean\": \"rm -rf dist tmp/tsc tmp/happo-custom\",\n \"lint\": \"eslint .\",\n \"prepublishOnly\": \"pnpm clean && pnpm build\",\n \"storybook:dev\": \"storybook dev --config-dir src/storybook/__tests__/storybook-app -p ${PORT:-6007}\",\n \"test\": \"node --env-file-if-exists=.env.local ./scripts/test.ts\",\n \"test:custom\": \"pnpm build:dist && pnpm build:custom && node --env-file-if-exists=.env.local dist/cli/index.js -c ./happoconfigs/happo.custom.config.ts\",\n \"test:cypress\": \"pnpm build:dist && node --env-file-if-exists=.env.local dist/cli/index.js -c ./happoconfigs/happo.cypress.config.ts e2e -- cypress run -C src/cypress/__cypress__/cypress.config.ts\",\n \"test:cypress:open\": \"cypress open -C src/cypress/__cypress__/cypress.config.ts\",\n \"test:playwright\": \"pnpm build:dist && node --env-file-if-exists=.env.local dist/cli/index.js -c ./happoconfigs/happo.playwright.config.ts e2e -- playwright test\",\n \"test:storybook\": \"pnpm build:dist && node --env-file-if-exists=.env.local dist/cli/index.js -c ./happoconfigs/happo.storybook.config.ts\",\n \"test:pages\": \"pnpm build:dist && node --env-file-if-exists=.env.local dist/cli/index.js -c ./happoconfigs/happo.pages.config.ts\",\n \"tsc\": \"tsc --build tsconfig.json\"\n },\n \"browserslist\": {\n \"node\": [\n \"node 22\"\n ],\n \"browser\": [\n \"last 2 Chrome major versions\",\n \"last 2 Firefox major versions\",\n \"last 2 Safari major versions\",\n \"last 2 Edge major versions\"\n ],\n \"isomorphic\": [\n \"node 22\",\n \"last 2 Chrome major versions\",\n \"last 2 Firefox major versions\",\n \"last 2 Safari major versions\",\n \"last 2 Edge major versions\"\n ]\n },\n \"prettier\": {\n \"printWidth\": 85,\n \"singleQuote\": true,\n \"trailingComma\": \"all\",\n \"arrowParens\": \"always\"\n },\n \"devDependencies\": {\n \"@eslint/js\": \"^9.36.0\",\n \"@playwright/test\": \"^1.55.1\",\n \"@reporters/github\": \"^1.11.0\",\n \"@storybook/builder-vite\": \"^10.0.1\",\n \"@storybook/react-vite\": \"^10.0.1\",\n \"@types/async-retry\": \"^1.4.9\",\n \"@types/base64-stream\": \"^1.0.5\",\n \"@types/jsdom\": \"^27.0.0\",\n \"@types/mime-types\": \"^3.0.1\",\n \"@types/multiparty\": \"^4.2.1\",\n \"@types/node\": \"^24.9.1\",\n \"@types/react\": \"^19.2.0\",\n \"@types/react-dom\": \"^19.2.0\",\n \"@types/serve-handler\": \"^6.1.4\",\n \"cypress\": \"^15.5.0\",\n \"esbuild\": \"^0.27.0\",\n \"eslint\": \"^9.36.0\",\n \"eslint-config-prettier\": \"^10.1.8\",\n \"eslint-plugin-compat\": \"^6.0.2\",\n \"eslint-plugin-depend\": \"^1.3.1\",\n \"eslint-plugin-simple-import-sort\": \"^12.1.1\",\n \"eslint-plugin-unicorn\": \"^62.0.0\",\n \"jiti\": \"^2.6.0\",\n \"jsdom\": \"^27.0.0\",\n \"multiparty\": \"^4.2.3\",\n \"prettier\": \"^3.6.2\",\n \"react\": \"^19.2.0\",\n \"react-dom\": \"^19.2.0\",\n \"react-error-boundary\": \"^6.0.0\",\n \"serve-handler\": \"^6.1.6\",\n \"storybook\": \"^10.0.1\",\n \"typescript\": \"^5.9.2\",\n \"typescript-eslint\": \"^8.44.1\"\n },\n \"dependencies\": {\n \"async-retry\": \"^1.3.3\",\n \"base64-stream\": \"^1.0.0\",\n \"empathic\": \"^2.0.0\",\n \"fflate\": \"^0.8.2\",\n \"jose\": \"^6.1.0\",\n \"limit-concur\": \"^4.0.0\",\n \"mime-types\": \"^3.0.1\",\n \"srcset\": \"^5.0.2\"\n },\n \"storybook\": {\n \"displayName\": \"Happo\",\n \"icon\": \"https://happo.io/static/happo-hippo.png\",\n \"supportedFrameworks\": [\n \"angular\",\n \"ember\",\n \"html\",\n \"preact\",\n \"react\",\n \"react-native\",\n \"svelte\",\n \"vue\",\n \"web-components\"\n ],\n \"unsupportedFrameworks\": []\n },\n \"keywords\": [\n \"storybook-addon\",\n \"accessibility\",\n \"cypress\",\n \"playwright\",\n \"regression\",\n \"storybook\",\n \"test\",\n \"testing\",\n \"ui\",\n \"visual-regression\",\n \"visual\",\n \"vrt\"\n ],\n \"engines\": {\n \"node\": \">=22\"\n }\n}\n"],
|
|
5
5
|
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
package_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DYCU4INF.js";
|
|
4
4
|
|
|
5
5
|
// src/network/makeHappoAPIRequest.ts
|
|
6
6
|
import { SignJWT } from "jose";
|
|
@@ -138,4 +138,4 @@ async function makeHappoAPIRequest({ url, path, method = "GET", formData, body }
|
|
|
138
138
|
export {
|
|
139
139
|
makeHappoAPIRequest
|
|
140
140
|
};
|
|
141
|
-
//# sourceMappingURL=chunk-
|
|
141
|
+
//# sourceMappingURL=chunk-TCHC2O3E.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
makeHappoAPIRequest
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TCHC2O3E.js";
|
|
4
4
|
|
|
5
5
|
// src/network/createAsyncComparison.ts
|
|
6
6
|
function assertResultIsCreateAsyncComparisonResult(result) {
|
|
@@ -56,4 +56,4 @@ async function createAsyncComparison(config, {
|
|
|
56
56
|
export {
|
|
57
57
|
createAsyncComparison
|
|
58
58
|
};
|
|
59
|
-
//# sourceMappingURL=chunk-
|
|
59
|
+
//# sourceMappingURL=chunk-TPF2272Y.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
makeHappoAPIRequest
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-TCHC2O3E.js";
|
|
4
|
+
import "./chunk-DYCU4INF.js";
|
|
5
5
|
|
|
6
6
|
// src/network/createAsyncReport.ts
|
|
7
7
|
function assertResultIsCreateAsyncReportResult(result) {
|
|
@@ -37,4 +37,4 @@ async function createAsyncReport(snapRequestIds, config, { afterSha, link, messa
|
|
|
37
37
|
export {
|
|
38
38
|
createAsyncReport as default
|
|
39
39
|
};
|
|
40
|
-
//# sourceMappingURL=createAsyncReport-
|
|
40
|
+
//# sourceMappingURL=createAsyncReport-ZIO2Q6SS.js.map
|
package/dist/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AASA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AA+KrD,wBAAsB,IAAI,CACxB,OAAO,GAAE,KAAK,CAAC,MAAM,CAAgB,EACrC,MAAM,GAAE,MAAgB,GACvB,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AASA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AA+KrD,wBAAsB,IAAI,CACxB,OAAO,GAAE,KAAK,CAAC,MAAM,CAAgB,EACrC,MAAM,GAAE,MAAgB,GACvB,OAAO,CAAC,IAAI,CAAC,CA2Df"}
|
package/dist/cli/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
package_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DYCU4INF.js";
|
|
5
5
|
|
|
6
6
|
// src/cli/index.ts
|
|
7
7
|
import path2 from "node:path";
|
|
@@ -18,6 +18,7 @@ var CONFIG_FILENAMES = [
|
|
|
18
18
|
"happo.config.mts",
|
|
19
19
|
"happo.config.cts"
|
|
20
20
|
];
|
|
21
|
+
var DEFAULT_ENDPOINT = "https://happo.io";
|
|
21
22
|
function findConfigFile() {
|
|
22
23
|
if (process.env.HAPPO_CONFIG_FILE) {
|
|
23
24
|
return process.env.HAPPO_CONFIG_FILE;
|
|
@@ -30,19 +31,27 @@ function findConfigFile() {
|
|
|
30
31
|
}
|
|
31
32
|
return configFilePath;
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
-
if (!
|
|
35
|
-
throw new
|
|
36
|
-
"Missing `apiKey` in your Happo config. Reference yours at https://happo.io/settings"
|
|
37
|
-
);
|
|
34
|
+
function assertIsPullRequestTokenResponse(response) {
|
|
35
|
+
if (typeof response !== "object" || response === null || !("secret" in response)) {
|
|
36
|
+
throw new TypeError("Unexpected pull request token response");
|
|
38
37
|
}
|
|
39
|
-
|
|
38
|
+
}
|
|
39
|
+
async function getPullRequestSecret(endpoint, prUrl) {
|
|
40
|
+
const res = await fetch(`${endpoint}/api/pull-request-token`, {
|
|
41
|
+
method: "POST",
|
|
42
|
+
headers: { "Content-Type": "application/json" },
|
|
43
|
+
body: JSON.stringify({ prUrl })
|
|
44
|
+
});
|
|
45
|
+
if (!res || !res.ok) {
|
|
40
46
|
throw new Error(
|
|
41
|
-
|
|
47
|
+
`Failed to get pull request secret: ${res.status} - ${await res.text()}`
|
|
42
48
|
);
|
|
43
49
|
}
|
|
50
|
+
const json = await res.json();
|
|
51
|
+
assertIsPullRequestTokenResponse(json);
|
|
52
|
+
return json.secret;
|
|
44
53
|
}
|
|
45
|
-
async function loadConfigFile(configFilePath) {
|
|
54
|
+
async function loadConfigFile(configFilePath, environment, logger = console) {
|
|
46
55
|
try {
|
|
47
56
|
const stats = await fs.promises.stat(configFilePath);
|
|
48
57
|
if (!stats.isFile()) {
|
|
@@ -54,33 +63,61 @@ async function loadConfigFile(configFilePath) {
|
|
|
54
63
|
}
|
|
55
64
|
throw error;
|
|
56
65
|
}
|
|
57
|
-
const config = await import(configFilePath);
|
|
58
|
-
if (!config.
|
|
59
|
-
config.
|
|
66
|
+
const config = (await import(configFilePath)).default;
|
|
67
|
+
if (!config.apiKey && process.env.HAPPO_API_KEY) {
|
|
68
|
+
config.apiKey = process.env.HAPPO_API_KEY;
|
|
69
|
+
}
|
|
70
|
+
if (!config.apiSecret && process.env.HAPPO_API_SECRET) {
|
|
71
|
+
config.apiSecret = process.env.HAPPO_API_SECRET;
|
|
72
|
+
}
|
|
73
|
+
if (!config.apiKey || !config.apiSecret) {
|
|
74
|
+
const missing = [
|
|
75
|
+
config.apiKey ? null : "apiKey",
|
|
76
|
+
config.apiSecret ? null : "apiSecret"
|
|
77
|
+
].filter(Boolean).map((key) => `\`${key}\``).join(" and ");
|
|
78
|
+
if (!environment?.link) {
|
|
79
|
+
throw new Error(
|
|
80
|
+
`Missing ${missing} in your Happo config. Reference yours at https://happo.io/settings`
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
logger.log(
|
|
85
|
+
`Missing ${missing} in Happo config. Falling back to pull-request authentication.`
|
|
86
|
+
);
|
|
87
|
+
config.apiKey = environment.link;
|
|
88
|
+
config.apiSecret = await getPullRequestSecret(
|
|
89
|
+
config.endpoint || DEFAULT_ENDPOINT,
|
|
90
|
+
environment.link
|
|
91
|
+
);
|
|
92
|
+
} catch (e) {
|
|
93
|
+
throw new Error("Failed to obtain temporary pull-request token", { cause: e });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (!config.targets) {
|
|
97
|
+
config.targets = {
|
|
60
98
|
chrome: {
|
|
61
99
|
type: "chrome",
|
|
62
100
|
viewport: "1024x768"
|
|
63
101
|
}
|
|
64
102
|
};
|
|
65
103
|
}
|
|
66
|
-
if (!config.
|
|
67
|
-
config.
|
|
104
|
+
if (!config.integration) {
|
|
105
|
+
config.integration = {
|
|
68
106
|
type: "storybook"
|
|
69
107
|
};
|
|
70
108
|
}
|
|
71
|
-
const allTargets = Object.values(config.
|
|
109
|
+
const allTargets = Object.values(config.targets);
|
|
72
110
|
for (const target of allTargets) {
|
|
73
111
|
target.viewport = target.viewport || "1024x768";
|
|
74
112
|
target.freezeAnimations = target.freezeAnimations || "last-frame";
|
|
75
113
|
target.prefersReducedMotion = target.prefersReducedMotion ?? true;
|
|
76
114
|
}
|
|
77
115
|
const configWithDefaults = {
|
|
78
|
-
endpoint:
|
|
116
|
+
endpoint: DEFAULT_ENDPOINT,
|
|
79
117
|
githubApiUrl: "https://api.github.com",
|
|
80
118
|
targets: allTargets,
|
|
81
|
-
...config
|
|
119
|
+
...config
|
|
82
120
|
};
|
|
83
|
-
validateConfig(configWithDefaults);
|
|
84
121
|
return configWithDefaults;
|
|
85
122
|
}
|
|
86
123
|
|
|
@@ -762,7 +799,7 @@ function createReporter(opts = {}) {
|
|
|
762
799
|
|
|
763
800
|
// src/cli/index.ts
|
|
764
801
|
async function getVersion() {
|
|
765
|
-
const packageJson = await import("./package-
|
|
802
|
+
const packageJson = await import("./package-CB7WD7JO.js");
|
|
766
803
|
return packageJson.default.version;
|
|
767
804
|
}
|
|
768
805
|
function parseDashdashCommandParts(rawArgs) {
|
|
@@ -915,9 +952,9 @@ async function main(rawArgs = process.argv, logger = console) {
|
|
|
915
952
|
logger.log(helpText);
|
|
916
953
|
return;
|
|
917
954
|
}
|
|
918
|
-
const configFilePath = makeAbsolute(args.values.config || findConfigFile());
|
|
919
|
-
const config = await loadConfigFile(configFilePath);
|
|
920
955
|
const environment = await resolveEnvironment(args.values);
|
|
956
|
+
const configFilePath = makeAbsolute(args.values.config || findConfigFile());
|
|
957
|
+
const config = await loadConfigFile(configFilePath, environment, logger);
|
|
921
958
|
const command = args.positionals[0];
|
|
922
959
|
if (args.dashdashCommandParts) {
|
|
923
960
|
await handleE2ECommand(
|
|
@@ -952,10 +989,10 @@ async function main(rawArgs = process.argv, logger = console) {
|
|
|
952
989
|
async function handleDefaultCommand(config, environment, logger) {
|
|
953
990
|
logger.log("Running happo tests...");
|
|
954
991
|
const [startJob, createAsyncComparison, createAsyncReport, prepareSnapRequests] = await Promise.all([
|
|
955
|
-
(await import("./startJob-
|
|
956
|
-
(await import("./createAsyncComparison-
|
|
957
|
-
(await import("./createAsyncReport-
|
|
958
|
-
(await import("./prepareSnapRequests-
|
|
992
|
+
(await import("./startJob-T3PWEYOP.js")).default,
|
|
993
|
+
(await import("./createAsyncComparison-5X5OBHF2.js")).default,
|
|
994
|
+
(await import("./createAsyncReport-ZIO2Q6SS.js")).default,
|
|
995
|
+
(await import("./prepareSnapRequests-NPYZG2AI.js")).default
|
|
959
996
|
]);
|
|
960
997
|
await startJob(config, environment, logger);
|
|
961
998
|
try {
|
|
@@ -977,7 +1014,7 @@ async function handleDefaultCommand(config, environment, logger) {
|
|
|
977
1014
|
}
|
|
978
1015
|
} catch (e) {
|
|
979
1016
|
logger.error(e instanceof Error ? e.message : String(e), e);
|
|
980
|
-
const cancelJob = (await import("./cancelJob-
|
|
1017
|
+
const cancelJob = (await import("./cancelJob-GCTVJGYB.js")).default;
|
|
981
1018
|
await cancelJob("failure", config, environment, logger);
|
|
982
1019
|
process.exitCode = 1;
|
|
983
1020
|
return;
|
|
@@ -988,7 +1025,7 @@ async function handleFinalizeCommand(config, environment, logger) {
|
|
|
988
1025
|
logger.log("Config:", config);
|
|
989
1026
|
logger.log("Environment:", environment);
|
|
990
1027
|
try {
|
|
991
|
-
const finalizeAll = (await import("./wrapper-
|
|
1028
|
+
const finalizeAll = (await import("./wrapper-WKKUKM7T.js")).finalizeAll;
|
|
992
1029
|
await finalizeAll({ happoConfig: config, environment, logger });
|
|
993
1030
|
} catch (e) {
|
|
994
1031
|
logger.error(e instanceof Error ? e.message : String(e), e);
|
|
@@ -1017,7 +1054,7 @@ async function handleE2ECommand(config, environment, dashdashCommandParts, confi
|
|
|
1017
1054
|
logger.log("Config:", config);
|
|
1018
1055
|
logger.log("Environment:", environment);
|
|
1019
1056
|
logger.log("Dashdash command parts:", dashdashCommandParts);
|
|
1020
|
-
const runWithWrapper = (await import("./wrapper-
|
|
1057
|
+
const runWithWrapper = (await import("./wrapper-WKKUKM7T.js")).default;
|
|
1021
1058
|
const exitCode = await runWithWrapper(
|
|
1022
1059
|
dashdashCommandParts,
|
|
1023
1060
|
config,
|